#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Cwd;
use strict;

print header;
print start_html("Thank You!");
print h2("Thank You! We will reply by email soon.");

$ENV{PATH} = "/usr/sbin";

open (MAIL, "|sendmail -t -oi") or die "The web form failed. Sorry for the inconvenience!<br><br>Please email <a href=\"mailto:collegestationstrings\@gmail.com\">collegestationstrings\@gmail.com</a> directly.<br><br>Failed to send email: $!\n";


print MAIL "From: eric\@eggma.org\n";
print MAIL "To: eric\@eggma.org\n";
print MAIL "Subject: web contact form submitted\n\n";

 
open (LOG, ">/home/eggma/public_html/quartet/log/" . localtime() . ".txt") or die "The web form failed. Sorry for the inconvenience!<br><br>Please email <a href=\"mailto:collegestationstrings\@gmail.com\">collegestationstrings\@gmail.com</a> directly.<br><br>Failed to open log file: $!\n";


my %form;
foreach my $p (param()) {
    $form{$p} = param($p);
    print MAIL "$p = $form{$p}<br>\n";
    print "$p = $form{$p}<br>\n";
	print LOG "$p = $form{$p}\n";
}

print "<h3><a href=\"/\">Return to site</a></h3>";


close LOG;
close MAIL;
print end_html;


 
