use Net::SMTP;
use CGI ':standard';
#Get parameters from http string#
my $ServerName = param('server');
my $MailFrom = param('from');
my $MailTo = param('to');
my $Subject = param('subject');
my $Content = param('content');
print "Content-type: text/html\n\n";
print "\n
\n
Mail Results\n
\n
\n";
my $kill = 0;
if (!($MailFrom =~/\@*\./)) {
$kill = 1;
print "Invalid return address in From box.
";
}
if (!($MailTo !~/\@*\./)) {
$kill = 1;
print "Invalid destination address. Please notify the webmaster of this problem by sending an email to
wvhs-web\@charter.net.
";
}
if ($kill == 1) {
die("One or more errors have occurred which prevent the script from continuing further.
");
} else {
$smtp = Net::SMTP->new($ServerName, Debug => 0);
die "Couldn't connet to server: $!" unless $smtp;
$smtp->mail($MailFrom);
$smtp->to($MailTo);
$smtp->data();
$smtp->datasend("To: $MailTo\n");
$smtp->datasend("From: $MailFrom\n");
$smtp->datasend("Subject: $Subject\n");
$smtp->datasend("\n");
$smtp->datasend("$Content\n\n");
$smtp->dataend();
$smtp->quit();
print "Mail Sent Successfully\n
\n";
}
print "\n
";