#!/usr/local/bin/perl -w
use strict;
# Let's have some fun my'ing things, shall me?
my %form;
my $url;
my $message;
my $sendmail;
my $subject;
my $signature;
my $disclaimer;
my $adminmail;
my $redirect;
use CGI;
my $query = CGI->new;
print $query->redirect($redirect);
%form = %{$query->Vars};
##################### BEGIN EDITING THIS SECTION #############################
$sendmail = "/var/qmail/bin/qmail-inject";
$url = 'http://secretrealmofme.hypermart.net';
$adminmail = 'admin@mail.com';
$redirect = "http://secretrealmofme.hypermart.net";
$subject = "Your $form{'friend'} thought you might be interested";
$signature = 'Your Name';
( $message = <<"EOM" ) =~ s/^\s+//gm ;
Your friend $form{'username'} recently visited our site and thought you might be interested!\n\n
Our site has lots of stuff! blah blah blah.\n\n
Please take a look at $url and see what all the fuss was about!\n\n
EOM
;
( $disclaimer = <<"EOD" ) =~ s/^\s+//gm ;
This message was sent from your friend from $ENV{'REMOTE_ADDR'} .
We do not believe in spamming and would never do so. Your friend
personally added your email address and sent this.
EOD
;
#################### STOP EDITING FOR NOW #####################################
### Make sure things are being completed, die slackers!
if ($form{'username'} eq "") {
print "Please click back and fill out your name!\n";
exit;
}
if ($form{'email'} eq "") {
print "Please click back and fill in your friend's email address!\n";
exit;
}
# All done, let's send the email
open (MAIL, '|-', "$sendmail -t") or die("Cannot open file: $!\n");
print MAIL "To: $form{'email'}\n";
print MAIL "From: $adminmail\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
print MAIL "$disclaimer\n";
close(MAIL);
# Let's give them something to look at, might as well, they were nice enough to fill out the form!
####################### BEGIN EDITING HERE 2 ######################################
print <