#!/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 "Entry Error: Email Field Blank\n"; print "\n"; 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 "\n"; print MAIL "$FORM{'First'}\n"; print MAIL "$FORM{'Last'}\n"; print MAIL "$FORM{'emaila'}\n"; print MAIL "

$FORM{'Address'}
\n"; print MAIL "$FORM{'City'}\n"; print MAIL "$FORM{'State'}\n"; print MAIL "$FORM{'Zip'}\n"; print MAIL ""; print MAIL " \n"; print MAIL "$FORM{'version'}\n"; print MAIL "\n"; print MAIL "\n"; close (MAIL); # Open the mail file and write to it # if user is subscribing to maillist if ($FORM{"announce"} eq "yes") { open (MAIL, "|$mailprog $sub_recipient") || die "$mailprog not available.\n"; print MAIL "From: $FORM{'emaila'}\n"; print MAIL "Subject: subscribe freebsd-announce $FORM{'emaila'}\n\n"; print MAIL "subscribe freebsd-announce $FORM{'emaila'}\n"; close (MAIL); } print "\n"; print "\n"; print "Mail Sent\n"; print "\n"; print "\n"; print " \n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "

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 "

\n"; print "\n"; 1;