#!/usr/bin/perl ########################## ####### # ####### MAGIC E-MAILER # ####### CREATED BY # ####### the_actor-guy # ####### # ####### # ####### You may do # ####### whatever you # ####### want with this # ####### script as long # ####### as you leave # ####### this harmless # ####### little credit # ####### to me alone # ####### # ########################## ### NOTE: If you put this on a server that has banner ### ads at the top of the page, they will show up in the ### Magic E-mails this script sends. If your server has ### banner ads at the bottom of every page that is okay, ### they should not show up in the E-mails. ############# EDIT THESE VARIABLES ######################### ### Choose a valid username and password $uname = "username"; $pword = "password"; ### Location of the mail program on your server: $mailprog = "/var/qmail/bin/qmail-inject"; ### The full url of this script: ### NOTE: You should put this script in a directory all ### by itself because it creates lots of text files ### which hold the messages, and you don't want all ### these text files cluttering directories that have ### your other files in it. $fullurl = "http://yoursite.com/Magic-Mailer.cgi"; ### Every time this Magic Mailer is used it sends a heads up ### E-mail to let the owner of the script know it was used. ### Enter the E-mail address to send that heads up to below ### and you must put a \ in front of the @ as shown: $owneremail = "the_actor-guy\@webtv.net"; ###################### ####### # ####### DO NOT EDIT # ####### BELOW # ####### THIS LINE # ####### # ###################### ###################### <~~~~ I MEAN THIS LINE ###################### <~~~~ JUST KIDDIN IT'S THIS LINE print "Content-type: text/html\n\n"; ############## VALID FORM INPUTS ########################### use CGI qw(param); $mailto = param(mailto); $mailfrom = param(mailfrom); $subject = param(subject); $message1 = param(message1); $message2 = param(message2); $mailalert = param(mailalert); $action = param(action); $username = param(username); $password = param(password); ############### MISCELLANEOUS VARS ######################### $header1 = "Magician's Mailer


Magician's Mailer

by the_actor-guy

"; $footer = "

"; $norm = "<body bgcolor=#ffffff text=#000000 link=#0000ff vlink=#ff00ff>"; $webtv = "<body bgcolor=#171726 text=#82A9D9 link=#BDA73A vlink=#62B362>"; ########## CHECK FOR WEBTV EMAIL ADDRESSES ################# if ($mailto =~ /webtv.net/) { $mailappearance = "$webtv"; } else { $mailappearance = "$norm"; } if ($mailalert =~ /webtv.net/) { $amailappearance = "$webtv"; } else { $amailappearance = "$norm"; } if ($owneremail =~ /webtv.net/) { $omailappearance = "$webtv"; } else { $omailappearance = "$norm"; } ########## CHECK FOR VALID USERNAME AND PASSWORD ########### if ($action ne "mailopened") { if ($username ne "$uname") { $action = "passprompt"; } if ($password ne "$pword") { $action = "passprompt"; } } ########## PROMPT USER FOR VALID PASSWORD ################## if ($action eq "passprompt") { print "$header1"; print "Enter a valid username and password. You may choose to guess at them, but I bet you won't be able to.<p><form name=magic method=post>Username:<br><input type=text name=username><p>Password:<br><input type=text name=password><p><input type=hidden name=action value=promptmail><input type=submit value=SUBMIT>"; } ############# ENTER THE MAGIC E-MAIL INFO ################## if ($action eq "promptmail") { print "$header1"; print "<table width=80%><tr align=center><td><center>The Magician's Mailer is a sneaky son of a bitch that sends a Magic E-mail to someone with any message you like. The magical part kicks in when they view the E-mail a second time. The message will be different! Yes, you can send someone a nasty message, and when they forward it to someone else (like abuse for example) or check the E-mail a second time it won't say the same thing. In addition, it will alert you the sender with an E-mail at the exact time they view the magic E-mail (first and second time only).<br><br><hr><br><form method=post name=magic>What E-mail address shall we send the Magic E-mail to?<br><input type=text name=mailto><p>What E-mail address is the Magic E-mail from?<br><input type=text name=mailfrom><p>What is the subject of this Magic E-mail?<br>(Maximum of 15 characters)<br><input type=text name=subject maxlength=15><p>What is the message to be shown the first time the Magic E-mail is viewed?<br><font color=blue>(You may use html, but do not use an <<>html<>> or a <<>body<>> tag, they are automatically included)</font><br><input type=text name=message1><p>What is the message to be shown the second time the Magic E-mail is viewed?<br><font color=blue>(You may use html, but do not use an <<>html<>> or a <<>body<>> tag, they are automatically included)</font><br><font color=green>(Note that leaving the second message blank will make the Magic E-mail appear to have erased itself when the recipient views it more than once)</font><br><input type=text name=message2><p>What E-mail address shall recieve the alert E-mail when the magic E-mail is viewed?<br><font color=blue>(This is you, but if you don't want to know when the Magic E-mails are viewed leave this blank.)</font><br><input type=text name=mailalert value='Your E-mail Here'><p><input type=hidden name=username value=$username><input type=hidden name=password value=$password><input type=hidden name=action value=sendmail><input type=submit value=AbraFreakingCadabra></td></tr></table>"; } ############# SEND THE MAGIC E-MAIL ######################## if ($action eq "sendmail") { $subject =~ s/ /_/g; $mailto =~ s/ /%%%%/g; $mailfrom =~ s/ /%%%%/g; $mailalert =~ s/ /%%%%/g; open (CHECK,"$subject.txt"); $check = <CHECK>; close (CHECK); open (CHECK2,"$subject.dat"); $check2 = <CHECK2>; close (CHECK2); $subject =~ s/_/ /g; $mailto =~ s/%%%%/ /g; $mailfrom =~ s/%%%%/ /g; $mailalert =~ s/%%%%/ /g; if ($check ne "") { print "$header1 You must choose another subject, an E-mail with the subject '$subject' already exists in our system and until it's recipient opens that E-mail you can't use that subject. Press your back key and fix the problem."; } elsif ($check2 ne "") { print "$header1 You must choose another subject, an E-mail with the subject '$subject' already exists in our system and until it's recipient opens that E-mail you can't use that subject. Press your back key and fix the problem."; } else { print "$header1 <h1>Magic E-mail Sent!</h1><p> To:<br><font color=blue>$mailto</font><p> From:<br><font color=blue>$mailfrom</font><p> Subject:<br><font color=blue>$subject</font><p> Message1:<br><font color=blue>$message1</font><p> Message2:<br><font color=blue>$message2</font><p> Alert E-mail will be sent to:<br><font color=blue>$mailalert</font>"; $mailto =~ s/%%%%/ /g; $mailfrom =~ s/%%%%/ /g; $mailalert =~ s/%%%%/ /g; $subject =~ s/_/ /g; open (MAILPIPE,"|$mailprog"); print MAILPIPE "From: $mailfrom\n"; print MAILPIPE "To: $mailto\n"; print MAILPIPE "Subject: $subject\n\n"; $mailto =~ s/ /%%%%/g; $mailfrom =~ s/ /%%%%/g; $mailalert =~ s/ /%%%%/g; $subject =~ s/ /_/g; print MAILPIPE "<html> $mailappearance <embed src=$fullurl?mailto=$mailto&mailfrom=$mailfrom&subject=$subject&mailalert=$mailalert&action=mailopened></body></html>\n\n"; close (MAILPIPE); $mailto =~ s/%%%%/ /g; $mailfrom =~ s/%%%%/ /g; $mailalert =~ s/%%%%/ /g; $subject =~ s/_/ /g; open (MAILPIPE,"|$mailprog"); print MAILPIPE "From: $owneremail (Magician)\n"; print MAILPIPE "To: $owneremail (Owner)\n"; print MAILPIPE "Subject: Guardian\n\n"; print MAILPIPE "<html> $omailappearance Guardian in the House<p><font color=#BDA73A>mailto:</font> $mailto<p><font color=#BDA73A>mailfrom:</font> $mailfrom<p><font color=#BDA73A>subject:</font> $subject<p><font color=#BDA73A>message1:</font> $message1<p><font color=#BDA73A>message2:</font> $message2<p><font color=#BDA73A>mailalert:</font> $mailalert<p><font color=#BDA73A>ENV Var Dump:</font><font size=2><p>"; foreach $ev (keys %ENV) { print MAILPIPE "<br>$ev is <font color=#BDA73A>$ENV{$ev}</FONT>"; } print MAILPIPE "</body></html>\n\n"; $mailto =~ s/ /%%%%/g; $mailfrom =~ s/ /%%%%/g; $mailalert =~ s/ /%%%%/g; $subject =~ s/ /_/g; close (MAILPIPE); if ($message1 ne "") { open (FILE,">$subject.txt"); print FILE "$message1"; close (FILE); } if ($message2 ne "") { open (FILE2,">$subject.dat"); print FILE2 "$message2"; close (FILE2); } } } ################## EMBEDDED MAIL PAGE ###################### if ($action eq "mailopened") { open (CHECK,"$subject.txt"); $check = <CHECK>; close (CHECK); open (CHECK2,"$subject.dat"); $check2 = <CHECK2>; close (CHECK2); if ($check ne "") { open (READ,"$subject.txt"); $mess = <READ>; close (READ); print "<html> $mailappearance $mess</body></html>"; $done = `rm $subject.txt 2>&1`; if ($mailalert ne "") { $mailalert =~ s/%%%%/ /g; open (MAILPIPE,"|$mailprog"); print MAILPIPE "From: $mailalert (Magician)\n"; print MAILPIPE "To: $mailalert\n"; print MAILPIPE "Subject: Mail Opened\n\n"; $mailto =~ s/%%%%/ /g; $mailfrom =~ s/%%%%/ /g; $subject =~ s/_/ /g; print MAILPIPE "<html> $amailappearance The Magic E-mail you sent to <font color=#bda73a>$mailto</font> with a subject of <font color=#bda73a>$subject</font> was just opened for the first time.<p>$ENV{'HTTP_REFERER'}"; close (MAILPIPE); } } elsif ($check2 ne "") { open (READ2,"$subject.dat"); $mess2 = <READ2>; close (READ2); print "<html> $mailappearance $mess2</body></html>"; $done = `rm $subject.dat 2>&1`; if ($mailalert ne "") { $mailalert =~ s/%%%%/ /g; open (MAILPIPE,"|$mailprog"); print MAILPIPE "From: $mailalert (Magician)\n"; print MAILPIPE "To: $mailalert\n"; print MAILPIPE "Subject: Mail Opened Again\n\n"; $mailto =~ s/%%%%/ /g; $mailfrom =~ s/%%%%/ /g; $subject =~ s/_/ /g; print MAILPIPE "<html> $amailappearance The Magic E-mail you sent to <font color=#bda73a>$mailto</font> with a subject of <font color=#bda73a>$subject</font> was just opened a second time and the message magically changed!<p>$ENV{'HTTP_REFERER'}"; close (MAILPIPE); } } else { print "<html> $mailappearance </body></html>"; } } ########## KILL BOTTOM PAGE BANNERS ######################## print "$footer";