#!/usr/bin/perl use Net::SMTP; print "Content-Type: text/html\n\n"; my %request = getForm(); my $mail = Net::SMTP->new("mail.egl.net"); # Setup the mail sender and recipient if ($request{'email'} eq '') { $request{'email'} = 'none' }; $mail->mail( $request{'email'}); $mail->to( $request{'to'} ); $mail->data(); #start sending the message body $mail->datasend("From: $request{'name'} <$request{'email'}>\n"); $mail->datasend("Subject: Email from website: onthegreenlogos.com\n\n"); $mail->datasend("Contact from webpage: $ENV{'HTTP_REFERER'}\n"); my ($data); $data = " The following is the information the person entered through the website: Name: $request{'name'} Comments: $request{'comments'} "; $mail->datasend($data); # Append footer and send mail $mail->datasend("\n\n---------------------------------------------------------\n"); $mail->datasend("This is an automated email generated by a web browser\n"); $mail->datasend("If you have any questions about this mail, please contact\n"); $mail->datasend("us at webmaster\@egl.net or 616-392-9949. Thanks!\n"); $mail->dataend(); $mail->quit(); # Show web page. print qq~ New Page 1

Your information has been submitted.

~; sub getForm { my ( $pair, $name, $value, $buffer, @pairs, %request ); if ( $ENV{'REQUEST_METHOD'} eq 'POST' ) { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'} ); } elsif ( $ENV{'REQUEST_METHOD'} eq 'GET' ) { $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1) )/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1) )/eg; $request{$name} = $value; } return %request }