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!

Sendmail?

Status
Not open for further replies.

TyzA

Programmer
Jan 7, 2002
86
BE
Hi,
Can anybody tell me what is wrong with this mail code.
What its purpose is? The script receives some values from a HTML form and send them via a mail to a specified e-mail address.
The script works, but the mail isn't sent!!!
The path for sendmail is also correct.

sub send_mail {
open(MAIL,"|$mailprog -t");
print MAIL "To: $to\n";
print MAIL "From: $mail\n";
print MAIL "Subject: Contact via de website\n\n";
print MAIL "Hoi,\n\n";
print MAIL "Ik ben $naam.\n\n";
print MAIL "Dit heb ik te vertellen:\n";
print MAIL "$comment\n\n";
close(MAIL);
}

$mailprog and $to are declared at the top of the code:

$mailprog = "/usr/sbin/sendmail";
$to="info\@dezonk.be";

The other variables are coming from the from.

Thanks in advance.

Tijs Programming is like sex: one mistake and you have to support it for the rest of your life.
 
Hi Try This,

You need to Close Input, I have bolded some items that you may need to look at.

sub send_mail {
open MAIL, "| $mailprog -t";
print MAIL "To: $to\n";
print MAIL "From: $mail\n";
print MAIL "Subject: Contact via de website\n\n";
print MAIL "Hoi,\n\n";
print MAIL "Ik ben $naam .\n\n";
print MAIL "Dit heb ik te vertellen:\n";
print MAIL "$comment\n\n";

close INPUT;
close MAIL;
}

Kind Regards, Paul Benn

**** Never Giveup, keep trying, the answer is out there!!! ****
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top