#!/usr/bin/perl -w
#################################################################################
## Author:      BRIAN HUNTER
## Date:        8/10/2020
## Email:       brian@sutechy.com
#################################################################################
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;
print header;
print start_html("RESULTS");
sub sendmail {
	my ($from, $to, $subject, $message) = @_;
	$ENV{PATH} = "/usr/sbin";
	open (MAIL, "|/usr/sbin/sendmail -oi -t") or 
    	  &dienice("Can't fork for sendmail: $!\n");
	print MAIL "To: $to\n";
	print MAIL "From: $from\n";
	print MAIL "Subject: $subject\n\n";
	print MAIL "$message\n";
	close(MAIL);
} 
# change this to your own e-mail address
my $recipient = 'brian@sutechy.com';
### Now print the body of your mail messaage.
##foreach my $p (param()) {
##  print MAIL "$p = ", param($p), "\n";
##}
# Now print a thank-you page
print <Thank You
Thank you for writing!
Return to our home page.
EndHTML
print end_html;
# The dienice subroutine handles errors
sub dienice {
    my($errmsg) = @_;
    print "ERROR
\n";
    print "$errmsg
\n";
    print end_html;
    exit 1;
}
exit;