#!/usr/bin/perl # # Perl program to send mail. # # $FreeBSD$ $mailprog = '/usr/sbin/sendmail'; print "Content-type: text/html\n\n"; if ($ENV{'REQUEST_METHOD'} eq "get") { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } @nvpairs = split(/&/, $buffer); foreach $pair (@nvpairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } if ($FORM{"emaila"} eq "") { print "\n"; print "
\n"; print "Your email address was left blank. Please enter it.\n";
print "\n";
print "\n";
exit(0);
}
$recipient = $FORM{'recipient'};
exit(0) if $recipient !~ /^[a-z_\.\-]+\@freebsd\.org$/io;
$sub_recipient = "majordomo\@FreeBSD.org";
#
# format the mail file
format MAIL =
~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$value
.
# Open the mail file and write to it
open (MAIL, "|$mailprog $recipient") || die "$mailprog not available.\n";
print MAIL "From: $FORM{'emaila'}\n";
print MAIL "Subject: FreeBSD Registration from $FORM{'emaila'}\n\n";
print MAIL "
Thank you, $FORM{'First'} $FORM{'Last'}, for your registration.\n";
print "
It has been submitted.\n";
if ($FORM{"announce"} eq "yes") {
print "
As you requested, you have also been subscribed to announce\@FreeBSD.org.\n";
}
print "