Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have the following portiun of the

Status
Not open for further replies.

samesale

Programmer
Sep 15, 2003
133
US
I have the following portiun of the program. However, the bottom mail section sends subject but the top does not. Please help.

sendmail = "/usr/lib/sendmail";
$email = $FORM{'email'};
$subject = "SALE ";
$sendto = "s\@sale.com";

open (MAIL, "| $sendmail $sendto ") or die "Couldn't open sendmail: ";

print MAIL "TO: $sendto\n";
print MAIL "FROM: $email\n";
print MAIL "Subject : $subject\n";
print MAIL "Sale Site - \n ";
print MAIL "Ad from $FORM{'name'} at $FORM{'address'} $FORM{'city'}";
print MAIL "$FORM{'state'} $FORM{'zipcode'}";
print MAIL " $FORM{'make'} and $FORM{'model'} for $d $FORM{'price'} with your description $FORM{'comment'} \n";
print MAIL " \n";

close (MAIL);

$mailprog ='/usr/lib/sendmail';

open (MAIL, "| $mailprog $email") or die "Could not open Mailprogram:";
print MAIL "TO: $email\n";
print MAIL "FROM: $sendto\n";
print MAIL "Subject : $subject\n";
print MAIL "Sale\n";
print MAIL "On day and date: $today: $mday-$thismon-$year \n";
print MAIL "You have provided this information:\n";
print MAIL "Your name : $FORM{'name'}. Your address: $FORM{'address'} in $FORM{'city'}\n";
print MAIL "$FORM{'state'} $FORM{'zipcode'}\n";
print MAIL "You phone : $FORM{'telephone'} to call you between $FORM{'time'}\n";
print MAIL "You are selling $FORM{'make'} $FORM{'model'} for $d $FORM{'price'} with your description: $FORM{'comment'} \n";
print MAIL " \n";

close (MAIL);
 
1) sendmail = "/usr/lib/sendmail"; should be $sendmail = "/usr/lib/sendmail";

2) print MAIL "TO: $sendto\n"; should be print MAIL "TO: $sendto\n"; (Single space, you have a tab)

Those are the only things I can see that might be wierd.

It may be good to try to run the commands by hand.

Personally, I NEVER use sendmail directly. Its non-portable and really error prone. Also implementations and security options vary system to system. Net::SMTP is the better way to go IMHO. It will work on all platforms without OS level dependacies. And you get realy debugging.
 
email is inputted in the form. I know that works. This is a part of a larger program. The suggested changes did not work. By the way, sendmail is $sendmail, I left out $ by mistake.
Thanks.

 
Your dealing with some sendmail funkiness, have you tried Net::SMTP yet?

 
No, thanks. Where can I find information on SMTP. I use Rafe Colburn's CGI in 24 Hours as a reference. Any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top