#!/usr/bin/perl
print "Content-type:text/html\n\n";
# parse the form data.
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;
}
# where is the mail program?
$mailprog = '/usr/sbin/sendmail';
# change this to your own email address
$recipient = 'nullbox@cgi101.com';
# this opens an output stream and pipes it directly to the
# sendmail program. If sendmail can't be found, abort nicely
# by calling the dienice subroutine (see below)
open (MAIL, "|$mailprog -t") or dienice("Can't access
$mailprog!\n");
# ... (Continues)