Gossamer Forum
Home : Products : DBMan : Customization :

Email problems

Quote Reply
Email problems
Hello All

Well, I guss it good that I am posting here, moved out of the Install Forum.

I have set up an auto reply to a form. I can get it to work if I use a specific "Email To" address. But if I put in the field name, nothing happens.

I am including the script that I added to the cfg, and pl file


In the cfg file:
# Added by David Breddam
# Full path to sendmail on your system
$mailprog = "|/bin/sendmail -t -oeq";
# Your email address
$db_email_field = 'Email';
# Admin Email address
$admin_email = 'you@yourserver.com';
# Additon Ended


and in the pl file;
in the sub html_add_success {

#Added by David Breddam - email option

%rec = &get_record($in{$db_key});
open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: $db_email_field\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Record Added\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Put the text of the message you want in here.
You can have more than one.....

#Addition Complete



all the files are available in TEXT format at: www.breddam.com/dbman


David Breddam
dbreddam@uniserve.com
Quote Reply
Re: Email problems In reply to
You need to put the email routines in the sub add_record routine in the db.cgi file NOT in the html.pl file.

You put the email codes after the following line in the sub add_record routine:

Code:
&html_add_success;

Hope this helps.

You need to follow the codes as written in the Mod you downloaded.

Smile

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Thanks for the correction.

I did move the code over to the cgi file, and located where you said to. Still no good. The interesting thing, if I put in an email address then it works. But it will not pick up an address from the database.

I have uploaded the files in TEXT form at:
http://www.breddam.com/dbman

I found this code from:
http://www.gossamer-threads.com/...m12/HTML/001145.html

I have discovered another problem. When I enter info into the form, it always puts the word "default" into field #3. I cannot track down where it might be getting this info from....any suggestions where this might be coming from.

Thank-you for your help.

David Breddam
dbreddam@uniserve.com
Quote Reply
Re: Email problems In reply to
One thing that I've done is installed the Secure Password Lookup, which stores email addresses in the default.pass file. Then I have used codes to "open" the .pass file and then print out the email address of the user, which sends messages to the user.

I would highly recommend using this Mod, which allows more flexibility of administrators and users. This Mod is located at the following URL:

www.jpdeni.com/dbman/mods.html

which should be the first place you look for Mods. The second place is the Resource Center.

Warning: Many "Mods" discussed in these Forums are in development, meaning that they are not official Mods and should be used with caution.

With regards to field #3...you have TWO identical fields,"Trial", in your configuration file. I would recommend deleting one of these fields, then re-number your fields. Then you will have to fix your database file.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Thanks for pointing out the duplicate field error. I was using that to buffer the problem. Since it always occurs in field #3, I have included a field "Trial" which will just end up always having "default" added to it. I eliminated the extra field.

I was just wondering why or where it might be coming from.

As for the email problem, I understand the mods or any code is development. Thats what make this so much fun.

What I don't understand is:
when I put in the field 'Email' this should pass the value of that field to the email variable in the script.
but this doesn't happen.

But! if I put in my own email address, eg: 'dbreddam@uniserve.com' it will send me email.

The other mods which I have looked at, seem to have more then I require. They include forms and password generators. I would think I may have more problems trying to alter them to do the simple part of sending someone an email based on an address they submit.

Is there any other way of passing the value of the "email" field onto the "send to" variable. OR does the value of the "email" field have to be altered in any way before being pass on.

This perl script is very interesting to a Access programer such as myself.

If I am not on track, please tell me so...

Again, thank-you very much....

David Breddam
Quote Reply
Re: Email problems In reply to
Ah...Yea...The Secure Lookup Mod does that...It places the email field from the record and sends it to the record owner.

Try installing the Secure Lookup Mod.

Good luck!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
The secure password email mod is installed.

But it is not working. The interesting thing, is I cut and paste all the code, and I did not get any errors when I tried it. But I didn't get any prompt for the mail input or password, so somewhere I am missing out on how to start it.

Currently I have set up three forms. Each enter info into the same db. This works fine. But then I added the mail mod. This one enters info into a test.db, but uses the same cgi file as the others. All my forms work fine, but I do not know where the email prompt is.

The following files are located at:
hdmech.cfg / .pl
hdmech1.cfg / .pl
hdmech2.cfg / .pl
mailmod.cfg / .pl
www.advanmedia.com/cg-bin/dbman

Each of these files are forms, and mailmod is the one which I have added the secure password email mod to.

You can log in under admin/admin

I have located all of these files in TEXT format at:
www.breddam.com/dbman

Any direction on what I am missing would help.

David Breddam
Quote Reply
Re: Email problems In reply to
Thank-you

both for the help. and for just being a good sounding board. I got the secure password mod to work. It really didn't take much except being very careful in the cut and paste.

Now I would like to trim it back. All I need to do is have a form, people will fill it out. With the correct email address they will get URL sent to them. Should I just modify the .pl file, and eliminate the parts I don't need. How will the security part work out.

Any suggestion?

David Breddam
Quote Reply
Re: Email problems In reply to
If you are talking about "trimming" the add forms, modify forms, etc. All you have to do is include the fields in your database that you want people to fill out in the sub html_record_form routine.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Since my last post, I have had time to look over everyting...and the problem I am coming up with, is I want to include the form, plus the email address into one submision. When the form is filled out, email address included, then the URL is emailed to them. The problem I am having, is any fields I have included in the html_signup_form does not get posted to the db.

Will I have to make two seprate entries, or is there a way of putting info from the sign_up_form into the db.??
Quote Reply
Re: Email problems In reply to
NO...With the Secure Password Lookup Mod, (which includes codes that you would place in the sub html_record_form), you use the following codes:

at the top of the sub html_record_form before the first print qq| and after the my (%rec) = @_;.

Code:
if ($in{'add_form'}) { $rec{'Email'} = &get_email;
}

Then add a hidden field:

Code:
Email Address: $rec{'Email'} <input type="hidden" name="Email" value="$rec{'Email'}">

I REALLY hope this helps.

Wink

Cheers,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
I am getting the following error. I have looked at the line, and can not see what it is missing or might be wrong. I know it is simple, but that is why I don't see it. I did cut and paste from your code above.

(I am guessing...is it the last set of brackets. I did try a few thing, but nothing worked.)


Error Message : fatal error: Undefined subroutine &main::get_email called at ./html.pl line 60.


The code at that point is:

my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

my $font = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';

if ($in{'add_form'}) { $rec{'Email'} = &get_email; }

print qq|


The entire code is availble at: in TXT format

www.breddam.com/dbman

David Breddam
Quote Reply
Re: Email problems In reply to
Thank you for saving your files as text files, so that we can see them.

The problem is that you do NOT have a closing right bracket for the &get_email codes. It should look like the following:

Code:
if ($in{'add_form'}) {
$rec{'Email'} = &get_email;
}

It should work now!

Smile

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Well, I thought it would be simple. I did look at the code and I think the bracket was out in the far right...anyways....I replaced the code with your example, cut and paste.

But it still is giving the same error. Undefined sub routine.

Again I loaded the file up to:
www.breddam.com/dbman

The actual form is located at:
http://www.advanmedia.com/cgi-bin/dbman2/db.cgi

This is a differant problem:

I would like restat what I am trying to do to ensure I am going the right way.

I require a person to fill out a survey, including the correct email address to recieve the URL link. They do not need a UsrId, or access to any of the great features of Dbman.

1) Can I disable or eliminate the UsrId portion.

2) Could more fields be added to the password file. I am thinking that I can't link the email to the person, unless they log in. But I don't want to have them loging in (too many steps). If I put the form info into the password file, then I would be able to make it a one step process, and link the survey info to the email address

3) Can more then one person have the same UsrId, but differant password when logging into the Dbman.

Daivd Breddam

David Breddam
Quote Reply
Re: Email problems In reply to
Make sure that you have defined any added new sub-routines in your html.pl or db.cgi files to the elsif section of the sub main in the db.cgi file.

WHICH sub-routine is showing UNDEFINED??????

(More information would be VERY helpful.)

I found that you did not define the &get_email routine in the sub main routine of db.cgi, which leads me to believe that you have not carefully installed the Secure Password Lookup with all its components in your db.cgi and html.pl files.

RE-INSTALL THE MOD AND MAKE SURE THAT YOU FOLLOW ALL INSTRUCTIONS AND INSERT ALL CODES FROM THE MOD!

1) If you are only allowing your users to add one record each, then it would NOT be a good idea to disable the Userid field for both the .pass file and the default.cfg file.

2) NOT recommended. If you want to have separate databases of information, then you should create separate database files (like members.db with members.cfg, input.db with input.cfg). The problem with adding fields to your .pass file are the following:

a) It would take EXTREMELY long for users to log into your system.

b) It is a security risk to put more data into a .pass file.

c) You would have to edit TONS of codes in the db.cgi file in order for this to work.

3) Nope. The way that the Secure Password Lookup operates is that unique userids and passwords are used for each user.

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




[This message has been edited by Eliot (edited November 08, 1999).]
Quote Reply
Re: Email problems In reply to
I hope you get thanked lots...again, thank-you for the help. All is working....I have backed it up, and now I will play with it.

Most of it was PEBKAC problems....

Again thanks..


David Breddam
Quote Reply
Re: Email problems In reply to
I forgot to ask....

Can I put in my own passwords into the pass file. I noticed that the password that is generated, is differant the the letters in the the file.

thanks again...

David
Quote Reply
Re: Email problems In reply to
 
Quote:
I hope you get thanked lots...again, thank-you for the help.

Once in a great while. Wink

Quote:
Can I put in my own passwords into the pass file. I noticed that the password that is generated, is differant the the letters in the the file.

ABSOLUTELY not. The passwords are auto-generated and encrypted. You can not use your own passwords in the .pass file.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Hello Eliot

Since you have been the one to help me out so much, I should say hello.

Of course we don't come calling without problems. And since you helped me with my stupid "missing comma" this morning. I thought I would see what I missed now.

1) I have installed the secure password, with the "get_mail" option. I also put in the code you passed on to me to put the email into the db. But it is not working now. I say now, because it was before. I installed my back up, but that didn't work either.

all the code is located in Text at:
www.breddam.com/help/hdmech

the form is being run at:
www.advanmedia.com/cgi-bin/hdmech/db.cgi

I also installed the mass mailer script. This is a killer tool.

As well, how many times do you have to register, is it for each instance of dbman used, or just once. We will be going live as soon we get all the kinks are worked out. But we are using a 4 copies of dbman for differant application currently.

Thanks agian...

David Breddam
Quote Reply
Re: Email problems In reply to
1) You have to add a hidden field for the Email field in order for it to print. Replace the following codes:

Code:
<tr><td>$rec{'Email'}</td></tr>

WITH THE FOLLOWING:

Code:
<tr><td>$rec{'Email'} <input type="hidden" name="Email" value="$rec{'Email'}"></td></tr>

I feel like I am repeating myself...oh my gosh...it is not only an emotion...it is reality! Frown

Look at one of my previous Posts.

2)

Quote:
I also installed the mass mailer script. This is a killer tool.

Glad you like it. I hope to release an improved version in the next few months.

3)

Quote:
As well, how many times do you have to register, is it for each instance of dbman used, or just once. We will be going live as soon we get all the kinks are worked out. But we are using a 4 copies of dbman for differant application currently.

You have to register by Site. You can use the same copy of DBMAN for as many projects as you like on the same web site. Basically, it is a Site license.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Re: the email prob. I did have that line in there. It was second last line in the the table.

Now that I put in your line of code, it puts in this |~~| in the location where the email address should be.

so I took out my extra line, and now nothing. I did look back your post, I even print out your examples, What is so fusterating...it all looks right, but I know I am missing something...probably a comma (LOL)

I put the extra line in there 'cause I was playing with the code..anyways....


I have uploaded the .pl file, and left the old one there as well
www.breddam.com/help/hdmech
html_new_pl.text

Thanks in advance..

David
Quote Reply
Re: Email problems In reply to
Hmm....I have looked at your files and I can't see any syntax errors.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Email problems In reply to
Just a note to say thanks. big time.

I have successfully re-installed a clean version. Saved it, and con't to play. anytime it doesn't work, just re-install the clean version. I would like to say thanks, all the help you have given me. Of course more questions to come, but this topic can be closed now.

I was looking through the other threads, and read about a flat file being no bigger then one meg. about how many records is that. I know it depends on the record size an such...but an average?

Otherwise thanks again.

David Breddam
Quote Reply
Re: Email problems In reply to
There really is no absolute number of maximum records in a flat file. It really depends on the record size and the overall record. You could do some calculations like the following:

Divide the 1,000,000 bytes by the average number of characters per record.

Example:

1,000,000 / 2,000 = 500

Here are the sizes of flat files I have operating on various sites I maintain:

1) 930,000 bytes (with 2,700 Records)
2) 1,300,000 byes (with 1,300 Records)
3) 40,000 bytes (500 Records)
4) 30,000 byes (300 Records)

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------