PDA

View Full Version : CGI->email not work


wizalex
02-22-2002, 05:44 PM
U try to install an old routine (Mailit '99) a very good and extremly simple mailing list... All works fine, i add members, but the email never came... Here's the sendemail code:


$sm = "/usr/lib/sendmail";


open (MAIL, "|$sm -t -O ErrorMode=m")

#Lets get some of the important stuff overwith.
print MAIL "Reply-To: $webadminmail\n";
print MAIL "Errors-To: $webadminmail\n";
print MAIL "Sender: $webadminmail\n";
if ($FORM{'priority'} eq "0"){
#Normal Priority (Left for future expansion)
}
elsif ($FORM{'priority'} eq "1"){
#Urgent!
print MAIL "X-PRIORITY: 2 (high)\n";
print MAIL "Priority: Urgent\n";
}
elsif ($FORM{'priority'} eq "2"){
#Not so very important.
print MAIL "X-PRIORITY: 5 (low)\n";
print MAIL "Priority: Low\n";
}
print MAIL "X-Mailer: Uninetsolutions.com MailIt! 99 Mailer\n";
print MAIL "Subject: $FORM{'subject'}\n";

#Where did it come from?
print MAIL "From: $listname <$webadminmail>\n";
print MAIL "To: $formprocdata\n";
print MAIL "$FORM{'body'}\n\n---\nPlease email $removeme if you wish to be removed from this list.\n\n";
close (MAIL);




That gives NO error, but it also don't send the email...
help?

I include the zip file (just as i downlowd it)

Stewart
02-22-2002, 06:18 PM
path to sendmail is usr/sbin/sendmail, so:

$sm = "/usr/lib/sendmail";

should be:

$sm = "/usr/sbin/sendmail";

wizalex
02-23-2002, 06:21 AM
But this is ("/usr/lib/sendmail") the path that HostRocket gives for sendmail. And we have the same path on our forum and works.

OK, i'll try it...

burdrumz
02-23-2002, 11:45 AM
Well, more than half of the mail paramaters that the script is using are not needed, and may not be supported. First thing I would do is get rid of everything, except To, From, and Subject.

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

#Lets get some of the important stuff overwith.
print MAIL "To: $formprocdata\n";
print MAIL "From: $listname <$webadminmail>\n";
print MAIL "Subject: $FORM{'subject'}\n";
print MAIL "$FORM{'body'}\n\n---\nPlease email $removeme if you wish to be removed from this list.\n\n";
close (MAIL);

print "Content-type: text/html\n\n";
print "Messages: $! <br> To: $formprocdata <br>From: $listname <br>Subject: $FORM{'subject'} <br>Body: $FORM{'body'}";
#make sure all the variables went through

Also, you should try to use CGI's param, and not that parse form sub that returns values in hash form; its very buggy.

use CGI 'param';
$value1=param('key1');
$value2=param('key2');

Instead of the whole $FORM thing...

wizalex
02-23-2002, 01:16 PM
Thanks, now i locate the problem. It was the -o flag

open (MAIL, "|$sm -t"); < that works
open (MAIL, "|$sm -t -o"); < that didn't

But, now i have a new problem.
The email came, but it send by NOBODY, and with NO SUBJECT.
IN the mail i saw that:

To: melody@freemail.gr
From: Nobody <nobody@host14.hrwebservices.net>
Date: Sat, 23 Feb 2002 12:00:28 -0500
X-DSMTPFooter: true
X-Rcpt-To: <melody@freemail.gr>
------end of headers-----

---mail body----
From: MyList <wizalex@artinoi.gr>
Subject: TEST
----------------


Any ideas?

burdrumz
02-24-2002, 10:48 AM
Guaranteed that the variables for the To and Subject fields are blank. Are you taking the info from a form? If so, did you use the right keys for the $FORM hash? Also, check out my article on www.hostrocket.info (I'm BK) telling about getting form info; it should clear some discrepencies up.

If you still can't figure it out, email the script (the one that you modified) to bk@netatswarrior.com as an attachment. (or attach it here), and I'll take a look at it.