Test (troubleshoot) mail service using telnet

This tutorial among with SMTP commands will help you to troubleshoot your mail service on a low level where you will see the mail server response.
These methods is very useful when you have to test – troubleshoot an existing mail box whether it accept the username credentials etc.

Take in mind that in the example bellow the telnet service is used and if you are Windows 7 user it is not installed by default. (Which is rather odd since this is very useful tool – but this is different matter)

Anyway, we are going to use telnet and will throw command exactly as the mail clients are doing. The difference will be that they are sending them really quick in a raw.

So, if your e-mail client is reporting an error logging in, but it is not obvious what the reason is, and you have double-triple checked your settings just replace the domain in the example and follow the steps.

Now, if you are logged this means that the mail client you are using is either not configured correctly or not working properly.
If you are wondering – the commands are the lines without ‘+OK’ at the beginning.

What if you can login with your mail client, but there are no messages coming.
You can test the mail server whether is will list your messages with ‘LIST’ command:

This will print a list with numbers which are actually your mails. For testing purposes I sent one mail (the last one) and now I want to read it. The command for that is ‘RETR’:

If you see the messages it seams that everything is fine and you should look for issues with your mail client or the application you are using to access the mail box.

Here is the full listing from my attempt if the separated ones are confusing you:

Filed Under: SMTP commands

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (2)

  1. Ross says:


    How I can troubleshoot IMAP using telnet?

  2. Tonny says:

    Hi Ross,

    You can use these commands to find whether IMAP is responding correctly:

    telnet MailServer 143
    Trying x.x.x.x …
    Connected to mail.server (x.x.x.x).
    Escape character is ‘^]’.
    * OK IMAP4 ready

    01 LOGIN UserName Password
    02 LIST “” *
    #shows you all available Folders

    03 SELECT folder
    04 STATUS mailbox (UNSEEN)
    #shows the information about a fodler

    #commands to view a message:
    05 FETCH 156 ALL # All IMAP headers
    05 FETCH 156 FULL # Full headers and body info
    05 FETCH 156 BODY # Body
    05 FETCH 156 ENVELOPE # Envelope
    05 FETCH * FULL # All email

    #156 is the number of the message, * is for all

    #Note: you have to put the numbers 01,02 etc. infront of the command

    I think this is enough for quick troubleshoot of IMAP.

Leave a Reply