#! /usr/bin/perl use CGI; use DB_File; use strict; my $request = new CGI; my $root_dir = '/home/sites/www.decosta.com/'; my $db_file = $root_dir . 'users/donald/ahs81/ahs81.db'; my $http_method = $ENV{"REQUEST_METHOD"}; my $referer = $ENV{"HTTP_REFERER"}; my $to_index = $request->param("to_index"); my $to_name = $request->param("to_name"); my $from = $request->param("from"); my $subject = $request->param("subject"); my $message = $request->param("message"); my %classmates; my @fields; my $from_error; # If we didn't come from the right place, abort #if (!($referer =~ /^http:\/\/www.decosta.com/) || (!($to_index =~ /\d\d\d/))) { # exit(1); # } print $request->header; # If no $from or we're doing a GET toss up the e-mail form if ((!($from =~ /.*\@.*\..*/)) || ($http_method eq "GET")) { if ($http_method ne "GET") { $from_error = '
A valid FROM e-mail address is required'; } print <AHS '81 Mailer

AHS '81 Classmate E-mailer


To:$to_name
From: $from_error
Subject:
Message:
FORM_HTML } else { # Open our data file, get our e-mail address and close the file tie %classmates, "DB_File", $db_file,"O_READ", 0640, $DB_HASH; @fields = split /:/,$classmates{$to_index}; untie %classmates; open (SENDMAIL,"|/usr/sbin/sendmail -t"); print SENDMAIL 'to: "' . $fields[2] . '" ' . "<$fields[3]>\n"; print SENDMAIL "from: <$from>\n"; print SENDMAIL "subject: $subject\n\n"; print SENDMAIL $message; print SENDMAIL "\n\n-- \n"; print SENDMAIL "This e-mail was sent from AHS81.ORG\n"; print SENDMAIL "The sender does not know your e-mail address\n"; print SENDMAIL "but they will see it if you choose to reply.\n"; print SENDMAIL "AHS81.ORG can not control the content of this message\n"; print SENDMAIL "contact abuse\@ahs81.org if there is a problem.\n"; close SENDMAIL; print < E-mail Sent

Message Sent

Return to www.ahs81.org CONFIRM }