Troubleshooting email, the Telnet way

Email is used daily by everyone from the top executives to the 5 year olds sending messages to their friends.  But what about tools to test and resolve issues?  Email tends to be weaker when it comes to troubleshooting tools.
One tool I'll briefly plug is SMTPDiag from Microsoft.  Released in the fall of 2004 it's a great tool for any email troubleshooting.
Today I want to cover a more basic, yet in some ways, more powerful email troubleshooting tool.  Many people do not realize that you can easily and quickly send a test message using telnet, a tool available with most operating systems.
Using telnet, you can talk to a sending mail server directly as if you were an email program.  Don't stop reading yet because it sounds difficult, it isn't, and it can benefit you more than you realize!  Whether you're an administrator that manages mail servers, a technical person that likes to keep up on cool things, or you're a home user wanting to find out why your email message didn't send, this simple walk-through is for you.
Now, why would you want to talk directly to the mail server?  The reasons are endless but let's give an example.  Let's say that all of a sudden your mail server stopped sending email and you're not sure why.  Is it your sending mail server, your email program, your firewall, your ISP or what?  This test will give you some solid clues how to isolate the issue.
There is one thing to keep in mind when using telnet.  A backspace might appear to work in your telnet session but the mail server won't accept it as a backspace.  So, if you type the email address or command wrong, don't use the backspace to correct it.  You should press enter and try again.  You may need to quit and start again.  You can see the affect of a backspace by using the backspace key in the body of the email and seeing what it looks like when you receive the email.
Let's dive in.  Note, if you want to skim and just use the actual commands, just type in the words in red. 
Open a blank telnet interface on your computer and connect to the mail server over port 25.  In Windows, you can do this from the command prompt by typing telnet 25
At this point you should see a small bit of information at the top of the telnet screen.  This is the mail server's initial welcome.  If you get a timeout and you are not trying to use your ISP's mail server, there is a chance that your ISP has blocked port 25.  Some mail servers also listen on alternate ports, for example 587, so you can try connecting using 587 instead of 25.  If neither work and you are sure your internet connection is working, you should contact your ISP to try to get the block removed.  Alternately you may be forced to use your ISP for all outgoing email.
Now, let's start talking to the server.  Type helo me
Set the From and To:
Mail from:
Rcpt to:
At this point, the mail server should say if the recipient was approved or not.  Some mail servers know at this point if it will allow it, some will accept the message and reject it later if it is invalid.  For the most part you can tell already if there is an issue with the sending or receiving email address.
Now we are ready to start into the Data part.  Here we can keep it plain and simple and start typing the body, or we can add some friendly headers to make the email look better.  I will include the friendly part at the top, but during testing it is not required.
First type: Data and press enter

Next add the headers and body:

From: "Scott Forsyth" <>
To: "Your name" <>
Subject: This is a test message sent from telnet
Here is where the body goes.  Notice the one blank line between the headers and the body of the email. 
Again, the three headers aren't required.  They can be in any order and they aren't case sensitive either.  You can also get away without any headers or with just the email address there like so:
To end the Data / body, there needs to be a line with only a . (dot) on it, and then press enter.  Like so:
That's it.  You should receive a brief status about the message and then you can exit by typing Quit.  Your message should be sent. 
This is surprisingly easy.  Just remember the key details.  Some mail servers don't require the helo me but it is a good habit to always enter it.  For a quick test for troubleshooting, here is a bare bones example:
telnet 25
helo me
This is a test

Here is yet another example with an image to show the whole process.
That is sufficient to send a test message on most mail servers.  Telnet is a powerful tool for testing email and really comes in handy for isolating mail related issues. 


  • yip, a quick and dirty way to test email servers and send a quick msg.

    although most email servers are now &quot;spam aware&quot; so they are requiring Authentication + no relaying, which can cause test problems. In addition, if you use your &quot;localhost&quot; email, if the domain that the email &quot;appears to be from&quot; doesnt match DNS records, then the receiving email server will reject it as well...

    SPAM has ruined Email as we know it.

  • You got it. There are other factors in play. Even my comment about leaving out the subject causes test messages to fail the spam tests sometimes, and the SMTP authentication is a key factor in testing. BTW, usually a server will allow you to send to email accounts on the same server without SMTP authentication so sending to yourself on the mail server you are on usually doesn't have issues with SMTP authentication. 'Helo me' isn't detailed enough to get by the spam filters without a warning flag. So, there are a few factors in play if trying to get a perfect email by a spam filter. Hopefully this serves as a way to do a quick and dirty test in most cases. I use it nearly daily myself. If a spam filter gets in the way then someone will need to tweak their steps more to get through.

  • Thanks for the useful artcle. Is it possible to authenticate with the mailserver via telnet using your username and password.

    What would the syntax look like?

Comments have been disabled for this content.