#!/usr/bin/perl # Define fairly-constants # This should match the mail program on your system. $mailprog = '/usr/lib/sendmail'; # This should be set to the username or alias that runs your # WWW server. $recipient = 'dspurvey@pmonline.com'; # 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; # 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; } # If the EmailAddr is blank, then give a "blank form" response &blank_response unless $FORM{'email'}; # Now send mail to $recipient $FORM{'Message'} =~ s/ /\n/gi; open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n"; print MAIL "From: SeeThisBuilding\@pmrentals.com\n"; print MAIL "To: $FORM{'email'}\n"; print MAIL "Reply-To: $FORM{'youremail'}\n"; print MAIL "Bcc: $recepient, gsc\@gscrentals.com\n"; print MAIL "Subject: PM Rentals Property Referred from $FORM{'fname'}\n\n"; print MAIL "------------------------------------------------------------\n"; print MAIL qq~ Your friend, $FORM{'fname'} $FORM{'lname'} ( $FORM{'youremail'} ) has suggested you take a look at the following PM Rentals Property Listing below. $FORM{'url'} To view other PM Rentals Listings please click on the link below http://www.pmrentals.com ~; print MAIL "\n------------------------------------------------------------\n"; #print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n"; #print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n"; print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n"; print MAIL "Remote Browser in use: $ENV{'HTTP_USER_AGENT'}\n"; #print MAIL "Refering page...just in case: $ENV{'HTTP_REFERER'}\n"; #print MAIL "Remote user: $ENV{'REMOTE_USER'}\n"; close (MAIL); # Make the person feel good for writing to us print "Content-type: text/html\n\n"; print qq~
|