#! /usr/bin/perl
@valid_address = ('webmaster@itri.loyola.edu',
'www@itri.loyola.edu',
'rhorning@itri.loyola.edu',
'rhorning@loyola.edu',
'gmh@itri.loyola.edu',
'sbg@loyola.edu',
'cmf@loyola.edu',
'tfoley@itri.loyola.edu',
'williams@loyola.edu',
'rtambo@itri.loyola.edu',
'registrations@itri.loyola.edu',
'hdmemworkshop@tokyo.itri.loyola.edu',
'baw@itri.loyola.edu');
use CGI qw(:standard);
$query = new CGI;
@names = $query->param;
foreach $temp (@names) {
if ($temp eq "to_name") {
$to_name = $query->param($temp);
} elsif ($temp eq 'to_address') {
$to_address = $query->param($temp);
if (grep(/$to_address/, @valid_address) < 1) {
$to_name .= "\:$to_address\:" . $query->remote_host();
$to_address = 'www@itri.loyola.edu';
}
} elsif ($temp eq 'from_name') {
$from_name = $query->param($temp);
} elsif ($temp eq 'from_address') {
$from_address = $query->param($temp);
} elsif ($temp eq 'subject') {
$subject = $query->param($temp);
} elsif ($temp eq 'required') {
@required = $query->param($temp);
} else {
@values = $query->param($temp);
$values = "";
foreach $cvalue (@values) {
$values .= "$cvalue\n";
}
$body .= "*** $temp ***\n$values\n";
}
}
open mail, "|/usr/sbin/sendmail $to_address" or do { print $query->header, 'An error has occurred. Unable to deliver your request. $!'; die; };
$envelope =
qq/From: $from_address ($from_name)
To: $to_address ($to_name)
Subject: $subject
/;
$voo = $envelope . $body;
print mail $voo;
$envelope =~ s/\n/
\n/g;
$body =~ s/\n/
\n/g;
print $query->header;
print $query->start_html(-title=>'Email Response', -BGCOLOR=>'white');
print $query->h1("Email Response . . .") . "$from_name, your message has been successfully queued for delivery. Below is a report listing what was sent.";
print $query->h2("Envelope") . $envelope;
print $query->h2("Contents") . $body;
print $query->hr . "Thank you" . $query->end_html