#!/usr/local/bin/perl

require "/usr/faculty/professor/cjlin/server-3.0/server/lib/cgi-lib.pl"; 

&ReadParse();

$name     = $in{'name'};
$addr     = $in{'address'};
$comments = $in{'comments'};
$type     = $in{'type'};
$server   = $in{'server'};

unless($addr)
{
    &blank_response;
    exit 0;
}

open(MAIL, "|/usr/lib/sendmail -oi -t") || die; 
print MAIL <<END;
To: cjlin\@csie.ntu.edu.tw 
From: $addr 
Subject: Web Server Comment for testneos
Reply-to: $addr,cjlin\@csie.ntu.edu.tw

Name: $name
Email: $addr

$comments
END
close(MAIL);

print <<END;
Content-type: text/html

<HEADER>
<TITLE>Comment Sent to testneos</TITLE>
</HEADER>
<BODY>
Thank you for your comment.
</BODY>
END

#
# No e-mail address
#

sub blank_response
{
  print <<END;
Content-type: text/html


<HEADER>
<TITLE>Comment for testneos</TITLE>
<BODY>
Please enter your e-mail address and resubmit.
</BODY>
END
  exit 0;
}
