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
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath
 
 
SMTP Command Primer

Let’s look at the conversation again.

HELO noddy.com                                                       

who I am- email host/domain,

MAIL FROM: dude@noddy.com                               

who I am – email address

RCPT TO: anotherdude@target.local                          

who I am mailing. Multiple recipients may be specified by using multiple RCPT lines 

DATA 

body of the message, including any further arguments, such as subject lines. This needs to be ended using a period “.” Followed by an empty line. Notice that extra tags such as subject: need to be followed by an empty line.

What we have achieved here is test that SMTP is up and  accepting mail. To make this more interesting, test for two way communication by requesting a delivery receipt:

Change the RCPT TO line to read:

RCPT TO :anotherdude@target.local notify=success,failure

How would we test for other conditions such as relaying allowed? Simple – change the RCPT TO: line to read another SMTP address for which delivery is not enabled. Here’s an example

If your mail host is configured correctly you will receive a polite – or not so polite message saying that your mail cannot be accepted. If the opposite occurs and your mail submission is succesfull for an email domain that doesn’t isn’t part of your SMTP servers inbound domain list – you have an open relay. A SPAM target. If this is facing the internet you should fix it really soon. Like now.

Here is a basic list of commands. This list is extensive enough to test anything you’re willing to try without breaking out of Telnet and using a mail client. These were sourced from RFC 821, which may be found here: http://www.faqs.org/rfcs/rfc821.html

HELO
MAIL
RCPT
DATA
RSET
NOOP
QUIT

Some of these are not discussed above.

RSET – resets the current session, allowing you to start again.
NOOP – No Operation. Does what it says. Use this to stay connected while thinking about your next command. Prevents timeouts.
QUIT – Quits the current session and disconnects.

Common Messages are listed below, however - to get to the exact meaning of virtually any SMTP code, have a look here: http://www.faqs.org/rfcs/rfc1893.html

211 System status, or system help reply
214 Help message
220 <domain> Service ready
221 <domain> Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to <forward-path>
354 Start mail input; end with <CRLF>.<CRLF>
421 <domain> Service not available,  closing transmission channel
450 Requested mail action not taken: mailbox unavailable
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
502 Command not implemented
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable
551 User not local; please try <forward-path>
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
554 Transaction failed

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