Spoofing emails using netcat

There are a few legitimate times when you find a need to speak raw SMTP to send an email. Here’s some scripts I’ve used in the past to help with that task.
Let’s start with echo.sh:

sleep 1
echo HELO nothax.nu
sleep 1
echo 'MAIL FROM:<[email protected]>'
sleep 1
echo RCPT TO:$1
sleep 1
echo DATA
sleep 1
`cat letter.txt`
echo '.'

Inside letter.txt you’ll have:

From: "Test User" <[email protected]>
To: <[email protected]>
Subject: Something good...
MIME-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit

LOL - Lots Of Love.

Then you call it and pipe it to nc with the smtp server on port 25:
./echo.sh [email protected] | nc gmail-smtp-in.l.google.com 25

Goodluck! Feel free to leave a comment below with feedback and corrections. Also if you found this helpful and would like occasional updates of things happening in this arena subscribe to the newsletter. Thanks!

No Comments Yet

Leave a Reply

Your email address will not be published. Required fields are marked *