#!/usr/bin/perl
#######################
#EmailResponse.pl     #
#Kevin Hanegan	      #
#Case Study # 1	      #
#######################
use CGI.pm;
$query = new CGI;
#######Configuration Section########
$mailpck = "/usr/sbin/sendmail";
$recipient = "peterbeaucage/@myrealbox.com";
$subject = "Comment form has been submitted";
#######End Config Section##########

#######Send email Section#######
open (MAIL, "| $mailpck -t") or die("$!\n");
print <<EMAIL
To: Greg Beaucage <$recipient>
From: $query->param('userName') <$query->param('email')>
Subject: $subject
Someone filled out your form
It was filled out by: $query->param('userName')
$query->param('comments')
EMAIL
close (MAIL);
#######End Append Section########
	
#####Dynamic Response HTML page######     
print <<HTML_RESPONSE
Content-type: text/html
	
<HTML>
<HEAD>
<TITLE>Email Response Confirmation</TITLE>
</HEAD>
<BODY>
<h2>Thank You! Your information has been sent successfully</h2>
The following listing is the information you sent:<br>
<b>Name</b>: $query->param('userName')<br>
<b>Email</b>: $query->param('email')<br>
<b>Comments</b>: $query->param('comments')<br>
</BODY>
</HTML>
HTML_RESPONSE
####End Dynamic Response HTML page####