#!/usr/local/bin/perl ################################################################ ################################################################ #### Constants & Definitions ################################################################ ################################################################ $DEBUG = 0; # Debug 0 = off $debugfile = "/tmp/debug.$$"; # Will be deleted when done $mailprog = '/usr/lib/sendmail'; # mail program on your system. $mailfile = '.' . $ENV{'PATH_INFO'} . '/email'; # Set to the current root $indexfile = 'http://www.consite.com/context/index.htm'; ################################################################ #### Setup ################################################################ # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # Print a title and initial heading print "Thank you"; print ""; open(FILE, $mailfile) || &mail_problems("Unable to open '$mailfile'."); while () { $recipient = $_; } close(FILE); # 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; #print "\$FORM{ ", $name," } to ", $FORM{$name },"

"; } ###################################### #### Check for Blank Required Fields # ###################################### &blank_phone_response unless ($FORM{'home_num'} || $FORM{'E-Mail'}); $FORM{'yname'} =~ s/ /_/g; ###################################### ### Now send mail to $recipient # ###################################### open (MAIL, "|$mailprog $recipient") || &mail_problems("Unable to send mail to '$recipient'."); ########################################################################## #### Print out the mail message - Auto Generated Code ################### ########################################################################## print MAIL "From: webuser\@consite.com\n"; print MAIL "Reply-to: $FORM{'E-Mail'}\n"; print MAIL "Subject: Quote Request Form\n"; print MAIL "\n\n"; print MAIL "Quote Request Form. \n\n"; ###################################################################### print MAIL "\nREQUESTOR INFORMATION\n"; ###################################################################### print MAIL " Your Name : $FORM{'yname'}\n"; print MAIL " Company Name : $FORM{'cname'}\n"; print MAIL " Home Address : $FORM{'add1'}\n"; print MAIL " City, State, Zip : $FORM{'city'} $FORM{'state'} $FORM{'zip'}\n"; print MAIL " Phone Number : $FORM{'phone_num'}\n"; print MAIL " E-mail : $FORM{'E-Mail'}\n"; ###################################################################### print MAIL "\nProject\n"; ###################################################################### print MAIL "$FORM{'project'}\n\n"; ###################################################################### print MAIL "\nREQUEST MORE INFORMATION\n"; ###################################################################### print MAIL " Context : $FORM{'moreinfo'}\n"; print MAIL " Sidco : $FORM{'sidinfo'}\n"; print MAIL " Techron : $FORM{'techinfo'}\n"; print "Thank you very much for your Quote Request." ; print "Return to our home page, if you like.

"; #******************************************************************************** # subroutine blank_phone_response #******************************************************************************** sub blank_phone_response { print "

Problem: Contact Info Missing

"; print "

Message not sent

"; print "
"; print "Your contact info appears to be blank, and was not sent "; print "Please use the Back button on your browser to return to the form and "; print "enter your Telephone number or Email address"; print "If you are having a problem, please send us Email at "; print "context\@consite.com, call (408) 748-8676, Thank you.\n"; print "

Return to our home page, if you like.<\P>"; print ""; exit; } sub mail_problems { $document_error = $_[0]; print "

Problem: Can not mail request

"; print "

Message not sent

"; print "
"; print "$document_error


\n"; print "Can not send email, Please contact us at:"; print "context\@consite.com or call (408) 748-8676, Thank you.\n"; print "

Return to our home page.<\P>"; print ""; exit; }