Gossamer Forum
Home : Products : DBMan : Installation :

Problem sending e-mail confirmation

Quote Reply
Problem sending e-mail confirmation
When a user has add a record then I will send him the just entered data as confirmation. Now I have the problem that I think two lines of my script are not working. First, I receive no e-mail becaus I think this line is not ok:

if ($in{'Email'}) {

'Email' is a field in my database where the user entres his e-mail address. I think in "sub add_record" this statement is not true? I will only send a e-mail to the user if he has entered a e-mail address.

Second, to open SENDMAIL I use want use this line:

open (MAIL, "|$mailprog $in{'Email'}");

If I have this line in my script then this will not run. Error 500.
When I edit the line to this:

open (MAIL, "|$mailprog info\@netdate.ch");

then the script is running.

Has everyone a idea what I should do?

Thanks
Rene
Quote Reply
Re: Problem sending e-mail confirmation In reply to
 
Quote:
open (MAIL, "|$mailprog $in{'Email'}");

First off, burn that code! It's very dangerous. If a user enters in ';rm -rf /' as his email address, you are asking for huge problems!

Use:

open (MAIL, "/usr/lib/sendmail -t");

the -t will pull the to address from the email message. As to the error, try turning on $db_debug, and also try adding:

print "Content-type: text/html\n\n";

as the first line in admin.cgi. This will make sure the html headers are produced before sendmail is called. The 500 server error just means sendmail produced an error before the headers were printed.

Hope this helps,

Alex
Quote Reply
Re: Problem sending e-mail confirmation In reply to
Thanks Alex

I started with

open (MAIL, "/usr/lib/sendmail -t");

but when I use this I never get a e-mail. This is why I used the othe command. Is it possible that there is a old version of sendmail?

Quote:
As to the error, try turning on $db_debug, and also try adding:

print "Content-type: text/html\n\n";

as the first line in admin.cgi.

But in DBMan I have no file called admin.cgi. Where can I find admin.cgi and do I need other scripts that sending of e-mail will work?

Rene
Quote Reply
Re: Problem sending e-mail confirmation In reply to
Sorry, was getting confused between programs. =) That should be db.cgi, not admin.cgi.

Cheers,

Alex
Quote Reply
Re: Problem sending e-mail confirmation In reply to
Thanks Alex

It works, I receive a e-mail if a new user sign up and one if new data are entered.

Rene