#!/usr/local/bin/perl # # mailsend.pl # version 961110 # copyright 1996 by bo larsson # all rights reserved # # bugs or feedback to bliss@seagull.net # for information on how to use, visit http://www.seagull.net/bliss/ $mailer = "/usr/sbin/sendmail -t"; $valist = ""; # Get the input and strip off all unwanted characters read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); $temp = $buffer; $temp =~ s/\+/ /g; $temp =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg; # Store the matching name and value pairs foreach (split(/&/,$temp)) { ($NAM, $VAL) = split(/=/, $_); $DATA{$NAM} = $VAL; $valist .= "$NAM:$VAL\n"; } # Grab necessary variables $sendto = $DATA{'sendto'}; $subject = $DATA{'subject'}; $response = $DATA{'response'}; $user_email = $DATA{'user_email'}; $user_name = $DATA{'user_name'}; # Send mail to $recipient open (MAIL, "|$mailer") || die "Can't open $mailprog!\n"; print MAIL "Subject: $subject\n"; print MAIL "From: $user_email ($user_name)\n"; print MAIL "To: $sendto\n"; print MAIL "\n"; print MAIL "$valist"; print MAIL "\n"; print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n"; close (MAIL); # Print the response print "Content-type:text/html\n\n"; print "Thank you"; print "$response"; print "";