I've got a simply mailer.cgi form processor by where I'm trying to have the functionality by where a specific drop down menu field emails specific email addresses. So that when the submit button is hit only certain people receive emails based on which dropdown menu selection they chose.
I've tried this for it gives me 500 internal server error:
if ($POST{'problem_category'{ eq "one"}
{ $send_mail = "info@mediaintentions.com";}
else if ($POST{'problem_category'} eq "two")
{ $send_mail = "info@bartonsprings.net";
}
#This is NOT Y2K compliant! This MUST be changed on Jan 1 2000 #
($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
$time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$year += 2000;
$date = "$days[$wday], $months[$mon] $mday, $year at $time";
print <<"(END HTML FOOTER)";
<hr size=1 width=75%><p>
</body>
</html>
(END HTML FOOTER)
}
}
sub send_mail {
local($print_config,$key,$sort_order,$sorted_field,$env_report);
open(MAIL,"|$mailprog -t");
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'}\n";
print MAIL "Cc: $Config{'email'}\n";
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: Response Form Submission\n\n" }
print MAIL "The following information was submitted by\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
print MAIL " \n";
print MAIL "Service Needed: $Config{'Service Needed'}\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
<html>
<head>
<title>Error: Bad Request Method</title>
</head>
<body bgcolor=#FFFFFF text=#000000>
<center>
<table border=0 width=600 bgcolor=#9C9C9C>
<tr><th><font size=+2>Error: Bad Request Method</font></th></tr>
</table>
<table border=0 width=600 bgcolor=#CFCFCF>
<tr><td>The Request Method of the Form you submitted did not match
either <tt>GET</tt> or <tt>POST</tt>. Please check the form and make sure the
<tt>method=</tt> statement is in upper case and matches <tt>GET</tt> or <tt>POST</tt>.<p>
<html>
<head>
<title>Error: Missing Recipient</title>
</head>
<body bgcolor=#FFFFFF text=#000000>
<center>
<table border=0 width=600 bgcolor=#9C9C9C>
<tr><th><font size=+2>Error: Missing Recipient</font></th></tr>
</table>
<table border=0 width=600 bgcolor=#CFCFCF>
<tr><td>No Recipient was specified in the data sent from the form. Please
make sure there is a 'recipient' form field with an email address.
<hr size=1>
<center><font size=-1>
</font></center>
</td></tr>
</table>
</center>
</body>
</html>
(END ERROR HTML)
}
<html>
<head>
<title>Error: Missing Required Information</title>
</head>
<center>
<table border=0 width=600 bgcolor=#9C9C9C>
<tr><th><font size=+2>Error: Missing Required Information</font></th></tr>
</table>
<table border=0 width=600 bgcolor=#CFCFCF>
<tr><td>The following information was left blank in your submissionp>
<ul>
$missing_field_list
</ul><br>
These fields must be filled in before you can successfully submit the form.<p>
Please use your browser's back button to return to the form and try again.<hr size=1>
<center><font size=-1>
</font></center>
</td></tr>
</table>
</center>
</body>
</html>
(END ERROR HTML)
}
}
exit;
}
Bookmarks