Marius van Witzenburg We fight for our survival, we fight!

5Jul/110

How to test your mail server SMTP communication with Telnet

Posted by mariusvw

SMTP without Authentication

In the below example lines starting with the number 220, 221, 250 and 354 are the responses.

telnet smtp.xs4all.nl 25
220 smtp-vbr10.xs4all.nl ESMTP Sendmail 8.13.8/8.13.8; Tue, 5 Jul 2011 20:07:48 +0200 (CEST)
HELO kitara.nl
250 smtp-vbr10.xs4all.nl Hello srv.kitara.nl [77.74.48.170], pleased to meet you
MAIL FROM: reply@kitara.nl
250 2.1.0 reply@kitara.nl... Sender ok
RCPT TO: marius@kitara.nl
250 2.1.5 marius@kitara.nl... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: Your Subject here
 
Your data here, note the blank line above!
.
250 2.0.0 smtp-vbr10.xs4all.nl accepted message p65I7m0V043931
quit
221 2.0.0 smtp-vbr10.xs4all.nl closing connection
Connection closed by foreign host.

SMTP with Authentication

This example is quite the same as the above one only it implements authentication.

telnet smtp.xs4all.nl 25
220 smtp-vbr10.xs4all.nl ESMTP Sendmail 8.13.8/8.13.8; Tue, 5 Jul 2011 20:07:48 +0200 (CEST)
HELO kitara.nl
250 smtp-vbr10.xs4all.nl Hello srv.kitara.nl [77.74.48.170], pleased to meet you
AUTH LOGIN
<base64 encoded username, mostly full email>
<base64 encoded password>
235 2.0.0 OK Authenticated
MAIL FROM: reply@kitara.nl
250 2.1.0 reply@kitara.nl... Sender ok
RCPT TO: marius@kitara.nl
250 2.1.5 marius@kitara.nl... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: Your Subject here
 
Your data here, note the blank line above!
.
250 2.0.0 smtp-vbr10.xs4all.nl accepted message p65I7m0V043931
quit
221 2.0.0 smtp-vbr10.xs4all.nl closing connection
Connection closed by foreign host.

Here a handy tool to encode or decode your data to base64.
http://ostermiller.org/calc/encode.html (Zip)

And remember kids, don't spam ;-)