#!/usr/local/bin/perl ###################### # General Mail Form To Work With Any Fields # Created 6/9/95 Last Modified 6/11/95 # Version 1.0 # Define Variables $mailprog = '/bin/sendmail'; $date = `/bin/date`; chop ($date); ###################### # Necessary Fields in HTML Form: # recipient = specifies who mail is sent to # username = specifies the remote users email address for replies # realname = specifies the remote users real identity # subject = specifies what you want the subject of your mail to be # Print the Initial Output Heading print "Content-type: text/html\n\n"; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). # $value =~ s/~!/ ~!/g; # Uncomment for debugging purposes # print "Setting $name to $value
"; $FORM{$name} = $value; } # Print Return HTML print "
"; $FORM{$name} = $value; # Print the MAIL for each name value pair print MAIL "$name: $value\n"; print MAIL "____________________________________________\n\n"; # Print the Return HTML for each name value pair. print "$name = $value