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 "<html><head><title>Form Diagnostics</title></head><body
bgcolor="#ffffff" text="#000000" id=all>";
print "<h2>Diagnostics for send mail form</h2>\n";
print "Referer = $ENV{'HTTP_REFERER'}\n";
print "Caller = $ENV{'CONTENT_LENGTH'}\n";
print "</body></html>";
# Notify mail has been delivered - krb
print "</body></html>";
print <<EndHTML;
<h2>Thank You</h2>
Thank you for writing. Your mail has been delivered.<p>
Return to our <a href=" page</a>.
</body></html>
EndHTML
sub dienice
{
($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}
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 "<html><head><title>Form Diagnostics</title></head><body
bgcolor="#ffffff" text="#000000" id=all>";
print "<h2>Diagnostics for send mail form</h2>\n";
print "Referer = $ENV{'HTTP_REFERER'}\n";
print "Caller = $ENV{'CONTENT_LENGTH'}\n";
print "</body></html>";
# Notify mail has been delivered - krb
print "</body></html>";
print <<EndHTML;
<h2>Thank You</h2>
Thank you for writing. Your mail has been delivered.<p>
Return to our <a href=" page</a>.
</body></html>
EndHTML
sub dienice
{
($errmsg) = @_;
print "<h2>Error</h2>\n";
print "$errmsg<p>\n";
print "</body></html>\n";
exit;
}