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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Mail script doesn't work. Need help!

Status
Not open for further replies.

pecan204

Programmer
Jan 25, 2001
24
0
0
US
Script doesn't work or give an error. see below.

Thanks for your comments!

#!/usr/bin/perl
# This script should send an e-mail


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

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

$mailprog = '/var/qmail/bin/qmail-inject';
$recipient = 'pecan204@netscape.com';
open (MAIL, "|$mailprog -t") or &dienice("Can't access $mailprog!\n");
print MAIL "To: $recipient\n";
print MAIL "Reply-to: $FORM{'email'} ($FORM{'name'})\n";
print MAIL "Subject: Form Data\n\n";

# krb print info from form to mail message.
foreach $key (keys(%FORM))
{
print MAIL "$key = $FORM{$key}\n";
}

close(MAIL);

#added to assess problems- krb!!!!!
print &quot;<html><head><title>Form Diagnostics</title></head><body
bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot; id=all>&quot;;
print &quot;<h2>Diagnostics for send mail form</h2>\n&quot;;
print &quot;Referer = $ENV{'HTTP_REFERER'}\n&quot;;
print &quot;Caller = $ENV{'CONTENT_LENGTH'}\n&quot;;
print &quot;</body></html>&quot;;

# Notify mail has been delivered - krb
print &quot;</body></html>&quot;;
print <<EndHTML;
<h2>Thank You</h2>
Thank you for writing. Your mail has been delivered.<p>
Return to our <a href=&quot; page</a>.
</body></html>
EndHTML


sub dienice
{
($errmsg) = @_;
print &quot;<h2>Error</h2>\n&quot;;
print &quot;$errmsg<p>\n&quot;;
print &quot;</body></html>\n&quot;;
exit;
}
 
Interesting! Would that be piedmont or in the low country?

I lived in Simpsonville SC near Greenville.
 
Pecan,
I tried to email you at the address listed above to minimize socializing off topic, but it bounced back. Charlestonian..... marsh mud and fiddler crabs....:)


keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top