Testing an email (SMTP) server with Telnet and SMTP commands.

A set of information that we use often is a list of SMTP commands that will allow you to Telnet into an email server to test if it is functioning correctly. Below is the process you can follow to test a SMTP server.

Telnet to the server on port 25. This will work from any command or terminal:
telnet mail.mycompany.com 25

Issue the HELO command and an alias:
helo itsolutions.co.za
You should receive a 250 Ok back from the server.

If you need to authenticate in order to send mail through the server you will need to issue the following command:
auth login
You will then need to enter the username and password on separate lines in order to authenticate but you will need to encode these into base64 before the server will accept them. There is a great, easy tool at http://www.webpan.com/Customers/Email/base64_conversion.htm which will allow you to quickly encode your details which you can then send to the server. If you are successful you will receive the following from the server: 235 Authentication successful.

Issue the MAIL FROM command to specify the sender email address:
mail from:myemail@mydomain.com
You should receive a 250 Ok back

Issue the RCPT TO command to specify the receiver email address:
rcpt to:receiver@theiremail.com
You should receive a 250 Ok back

Now to compose the email:
type DATA to begin your email content
You should receive something back from the server like 354 Enter mail
You can no enter a subject by typing:
subject:your subject
followed by enter
Then type the body of your email.

Follow this with an enter, then a full stop and then enter again. This will queue your email on the server to be sent to the address specified above.

Type quit to close your session with the email server. It should respond with message saying the connection has been closed.

Caveats:

  • Windows telnet does not work well with backspace when connecting to email servers. Therefore any errors you make will cause the commands you have entered to fail. Simply enter them again on a new line.
  • Messages sent via a telnet session usually look suspiciously simple to an email server and will often get rejected outright as spam by the server or the email will wind up in the junk mail folder of the specified recipient. The server will usually let you know if this has happened though.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>