#!/usr/bin/perl
$mailprog = "/usr/sbin/sendmail";
$recipient = "mfasbind\@us.ibm.com";


if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
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;
$contents{$name} = $value;

}
}

# Open The Mail
open(MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "To: $recipient\n;
print MAIL "From: $contents{'email'} <$contents'realname'}>\n;
print MAIL "Subject: $contents{'subject'}\n\n";
close(MAIL);

print <<"HTML";
<HTML>
<HEAD><TITLE>Thank you!</TITLE></HEAD>
<BODY BGCOLOR=#FFFFFF>
<H1>Thank you!</H1>
Thank you for your comments!
<P>
<HR>
<CENTER>
<A HREF="http://publib.boulder.ibm.com/pubs/html/plantworks/plntwrks.htm">[Return to the main page]</A>
</CENTER>
</BODY>
</HTML>
HTML
exit;