Simple Mail Testing

Insert a witty comment about how it’s been so long since my last post.

In my travels, I came across a handy file which I felt was share-worthy.

Have you ever had a need to quickly test an SMTP  connection via telnet or netcat? I have. If you don’t have a file like this already, feel free to steal it. Save it as ‘smtprelaymessage’:

EHLO smtp.example.com
MAIL From:<from@example.com>
RCPT To:<to@example.com>
DATA
Subject: Mail Relay Test

This is a test message.

Command is:

cat smtprelaymessage | telnet localhost 25

In the above example the message is a prepared smtpmail message

Signed,

The Kiwi
.
quit

The command to run is embedded in the message itself, so if you ever forget how to make it work just open the file and remember.

Now, obviously you need to decide whether to default ‘telnet’ or ‘nc’ as not all OSes have both anymore. You’ll also need to update the top three lines to be more useful data for your testing.

But this should be a good stepping stone to easy mail testing, if it is of any use to you.

Leave a Reply

Your email address will not be published.