The SMTP Codes every Good Email Admin Should Know

Written by Ed Fisher on February 9, 2011

email-dice

While many an admin can probably work for years without having to look at an SMTP log or network trace, they wouldn’t be email admins. As email admins sharpen their troubleshooting skills, learning the standard SMTP codes that are a part of every data exchange between servers will not only make parsing logs faster, it can help resolve issues with something as basic as a network trace.

The current RFC for the SMTP protocol is 5321. It defines all of the protocol exchanges between servers, and assigns a numeric response code to each. While vendors might implement their own text responses for a particular purpose, the numeric codes will be consistent across platforms.

Recognising the codes, and the pattern they exhibit during normal email transfers will not only help you validate that a server is functioning, but quickly identify when a server is not. In my post  Using telnet to test your mail server I cover the normal way that email servers transfer mail. You can click that link to get more detail, but here’s a brief recap.

telnetshot

220-You’ve made a connection
250-Your input is acceptable
354-The server is ready to accept your message
221-Your connection has closed

You will see those codes in an SMTP log, but sometimes, a log doesn’t show everything you need to resolve an issue. Remember, the numeric codes are standardised by the RFCs, but vendors can do practically anything they want with the text that accompanies the code. I once ran into a problem sending email to a remote recipient whose mailbox I knew was on the remote system, but I kept getting a 550 response back. A 550 means “Requested action not taken: mailbox unavailable.” Extended logging showed me a 5.7.1, and that usually indicates a “Relay not allowed.” Again, knowing the destination was local to the server that was bouncing my messages, the logging seemed to be pointing me in the wrong direction. Using WireShark to take a network trace, I finally saw what the destination server was saying

The IP you’re using to send mail is not authorized to 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at 550 5.7.1 http://mail.google.com/support/bin/answer.py?answer=10336 j1si6349282ybe.14 ##

And that helped me resolve the issue. Without knowing the response codes, and that what they indicated was not valid, I would never have taken a trace, and would never have seen the response message. You can read more about that here if you are curious. However, if you have limited time, spend it learning the table below. These are the codes that you need to know when debugging SMTP.

code meaning
211 System status or system help reply
214 Help message
220 Service ready
221 Service closing transmission channel
250 Requested mail action okay
251 User not local will forward to
252 Cannot VRFY user but will take message and attempt delivery
253 messages pending for node started
354 Start mail input end with
355 Octet-offset is the transaction offset
421 Service not available
432 A password transition is needed
450 Requested mail action not taken: mailbox unavailable
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
453 You have no mail
454 TLS not available due to temporary reason
458 Unable to queue messages for node node
459 Node node not allowed: reason
500 Syntax error
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
521 Machine does not accept mail
530 Must issue a STARTTLS command first
550 Requested action not taken: mailbox unavailable
551 User not local please try forwardpath
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
554 Transaction failed
Subscribe to my RSS feed

4 Comments to “The SMTP Codes every Good Email Admin Should Know”

  1. J.D. Falk Says:

    RFC 2821 was replaced by 5321 in 2008.

    http://tools.ietf.org/html/rfc5321

  2. Ed Fisher Says:

    Nice catch, J.D. Thanks.
    Ed

  3. Im a Geek Says:

    Just an additional info:

    The first two numbers of all SMTP codes can be broken down to specifics.

    Here are the first values with their descriptions:

    1 – server accepted the command, no action yet.
    2 – server completed the task
    3 – server got and understood the request. However, the server requires more info
    4 – server encountered a temporary setback

    5 – server encountered a total failure

    Here are the second values with their descriptions:

    0 – syntax error
    1 – informational reply (needs a HELP request)
    2 – denotes connection status
    3 / 4 unknown

    5 – status of the mail system in general

  4. Ed Fisher Says:

    Shiny, thanks Im!

Leave a Comment

Comment Policy