Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

   

Subscribe to OutlookExchange
Anderson Patricio
Ann Mc Donough
Bob Spurzem
Brian Veal
Catherine Creary
Cherry Beado
Colin Janssen
Collins Timothy Mutesaria
Drew Nicholson
Fred Volking
Glen Scales
Goran Husman
Guy Thomas
Henrik Walther
Jason Sherry
Jayme Bowers
John Young
Joyce Tang
Justin Braun
Konstantin Zheludev
Kristina Waters
Kuang Zhang
Mahmoud Magdy
Martin Tuip
Michael Dong
Michele Deo
Mitch Tulloch
Nicolas Blank
Pavel Nagaev
Ragnar Harper
Ricardo Silva
Richard Wakeman
Russ Iuliano
Santhosh Hanumanthappa
Shannal L. Thomas
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath
 
 

SMTP Command Primer

Page 1 | Page 2

In this article, you will learn what SMTP commands are and how to use them to test SMTP issues such as basic SMTP health, re-laying checking, SMTP versions, etc.

If we send or receive mail over the internet or using Exchange 2000 or higher, it was transported via SMTP. Knowing more about SMTP and how to troubleshoot SMTP on a basic level is essential. Tools for the job are knowledge of the command syntax and a remote terminal tool such as Telnet.

Let’s start by Telneting to port 25 of a mail host and see what comes out of it. The command syntax will be

Telnet hostname 25

If you’re running a flavor of Exchange, you may receive a reply similar to:

220 win2k3dc.target.local Microsoft ESMTP MAIL Service, Version: 6.0.3790.0 ready at  Thu, 31 Mar 2005 11:35:01 +0200

I’m going to break the reply down and explain each part:

220

A status code implying that Exchange is available and listening. SMTP mail systems have to return a status code for each line of every mail conversation, which indicates anything from command received successfully, to “go away – you’re not wanted here”. Some replies may only be numbers; others may be numbers with an explanatory text. At the end of this article I have listed some more detail about the meaning of these.

win2k3dc.target.local

The hostname responsible for the service

Microsoft ESMTP MAIL Service, Version: 6.0.3790

Software responding to the service request:

ready at  Thu, 31 Mar 2005 11:35:01 +0200

Note that if your machine is internet facing, it’s a really good idea to hide the response, also known as a banner. Knowing what software is installed on a machine gives a malicious person an idea as to how to start attacking. Here’s how you hide this message:

 http://support.microsoft.com/default.aspx?scid=kb;en us;281224

So what do we do now? How do we know what to type? SMTP conversations mirror human conversations in that humans greet, exchange pleasantries that help establish who we are, talk and then say goodbye. For a successful SMTP conversation to occur, something similar happens, and some of the words used may look familiar.

In SMTP talk, that may look like this:

Notice the first word after the 220 message was HELO. This could also have been EHLO. For the purposes of this article, SMTP can be presented in two basic flavors, SMTP and ESMTP. ESMTP is all that SMTP is, with some extra bits bolted on, like large message support, pipelining, authentication etc, which makes it a perfect candidate for Microsoft to build a transport mechanism around, which in fact is what they did. Most internal server to server messages originate and are received using ESMTP, not SMTP. Entering EHLO instead of HELO will produce a list of available commands that Exchange will accept, along with a “ready” message.

Each line was responded to by codes starting with a 2xx or a 5xx. Either my input was good 2xx or I entered a command that was flawed or unacceptable 5xx.

In this case, even though I’m trying to impersonate “noddy.com” my real domain is echoed back to me on the next line as: 250 win2k3dc.target.local Hello [127.0.0.1]

SMTP Command Primer

Nicolas Blank Page 1 | Page 2


Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

Copyright Stephen Bryant 2008