#!/usr/local/bin/perl -w
require "cgilib.pl";
#
# Configurable Variables
#
$SENDMAIL = '/usr/bin/sendmail';
$TO = 'guillowind@aol.com';
$SUBJECT = 'Survey Results';
$BACK = 'Back to my Homepage';
@FIELDS = qw(name email street city state zip rating comments);
# Output the HTML content type
print "Content-type: text/html\n\n";
# Initialize a hash of CGI arguments using
# routines from cgilib.pl
readParse(*dict);
# Build the 'from' address of the form:
# "email address, (real name)"
my $from = "$dict{email}, ($dict{name})";
# The -t causes the To: field to be read from standard input
# instead of being expected on the command line. The -oi
# prevents a dot on a line by itself from being interpreted
# as a message terminator.
open MAIL, "|$SENDMAIL -t -oi";
# Output the mail header
print MAIL <\n $dict{$_}\n\n";
}
# Output the mail footer
print MAIL <
$ENV{'REMOTE_HOST'}
$ENV{'REMOTE_ADDR'}
$ENV{'HTTP_USER_AGENT'}
EOMF
# Close the pipe, sending the mail
close MAIL;
# Generate HTML notification
print <
Your comments have been noted.
Thank you for your time.
$BACK