Okay there is something badly wrong with this script. I don't know what dev/null does exactly, but without it I get a 500 error, with it the script prints out the Confirmation message but doesn't send any e-mail. I'm not sure what I did wrong but you guys will probably spot it right away.
$reply_to = "Reply-to: formhandler\@greatmasterpieces.com";
$subject = "Subject: Great Masterpieces Feedback Form";
$to = "To: eloff\@helpmygame.com";
open (MAIL, "| /usr/sbin/sendmail -t -i >& /dev/null"
or die "Cannot open sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$input);
foreach $pair(@pairs){
($name, $value) = split(/=/,$pair);
$value =~ tr/+//;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\n//g;
$value =~ s/\r//g;
$content = "$name = $value\n";
print SENDMAIL $content;
}
close(MAIL);
print "Content-type: text/html\n\n";
print "Confirmation of your submission will be emailed to you.";
Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada
If at first you dont't succeed, try, try again. - programmer's motto.
$reply_to = "Reply-to: formhandler\@greatmasterpieces.com";
$subject = "Subject: Great Masterpieces Feedback Form";
$to = "To: eloff\@helpmygame.com";
open (MAIL, "| /usr/sbin/sendmail -t -i >& /dev/null"
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$input);
foreach $pair(@pairs){
($name, $value) = split(/=/,$pair);
$value =~ tr/+//;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\n//g;
$value =~ s/\r//g;
$content = "$name = $value\n";
print SENDMAIL $content;
}
close(MAIL);
print "Content-type: text/html\n\n";
print "Confirmation of your submission will be emailed to you.";
Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada
If at first you dont't succeed, try, try again. - programmer's motto.