#!/usr/misc/bin/perl
#BCM
require 'cgi-lib.pl';

# get input

# Put your email address here
$wwwcontact = "maguireb@norwich.net";

# temporary file to write to
$tempfile =   "formtemp$$";

&ReadParse;             # from cgi-lib.pl
print &PrintHeader;     # from cgi-lib.pl

open(SENDMAIL, ">$tempfile");

print SENDMAIL "To: $wwwcontact\n";
print SENDMAIL "Subject: *** WWW Comment form ***\n";
print SENDMAIL "From: $in{email}\n";
print SENDMAIL "\n";
print SENDMAIL "*** WWW Comment form ***\n\n";
print SENDMAIL "User Identified Self As: $in{name}\n";
print SENDMAIL "User Connected From: $ENV{REMOTE_HOST}\n\n";

if ($in{1star} eq "on") {
  print SENDMAIL "[X] 1star\n";
  }
else{
  print SENDMAIL "[ ] 1star\n";

if ($in{2star} eq "on") {
  print SENDMAIL "[X] 2star\n";
  }
else{
  print SENDMAIL "[ ] 2star\n";
  }
if ($in{3star} eq "on") {
  print SENDMAIL "[X] 3star\n";
  }
else{
  print SENDMAIL "[ ] 3star\n";
  }
if ($in{4star} eq "on") {
  print SENDMAIL "[X] 4star\n";
  }
else{
  print SENDMAIL "[ ] 4star\n";
  }

if ($in{comment} eq "on") {
  print SENDMAIL "[X] comment\n";
  }
else{
  print SENDMAIL "[ ] comment\n";
  }

if ($in{question} eq "on") {
  print SENDMAIL "[X] question\n";
  }
else{
  print SENDMAIL "[ ] question\n";
  }

if ($in{suggestion} eq "on") {
  print SENDMAIL "[X] suggestion\n";
  }
else{
  print SENDMAIL "[ ] suggestion\n";
  }

if ($in{praise} eq "on") {
  print SENDMAIL "[X] praise\n";
  }
else{
  print SENDMAIL "[ ] praise\n";
  }

if ($in{other} eq "on") {
  print SENDMAIL "[X] other\n";
  }
else{
  print SENDMAIL "[ ] other\n";
  }

print SENDMAIL "Message: \n";
print SENDMAIL "//////////////////////////////////////////////////////////\n";
print SENDMAIL "$in{message}\n";
print SENDMAIL "//////////////////////////////////////////////////////////\n";

close(SENDMAIL);

system("/usr/lib/sendmail -t < $tempfile");
#system("rm $tempfile");

print "<H2>Your message has been sent successfully!</H2><BR>
<H3>Thank you for your comments. If you included your email address, I'll respond as soon as possible.<P><BR><BR>\n";


