Wednesday, April 22, 2009

SMTP Status Codes

These ones are by RFC821

211
System status, or system help reply

214
Help message
(Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user)

220
Service ready

221
Service closing transmission channel

250
Requested mail action okay, completed

251
User not local; will forward to

354
Start mail input; end with .

421
Service not available, closing transmission channel
(This may be a reply to any command if the service knows it must shut down)

450
Requested mail action not taken: mailbox unavailable
(E.g., mailbox busy)

451
Requested action aborted: local error in processing

452
Requested action not taken: insufficient system storage

500
Syntax error, command unrecognized
(This may include errors such as command line too long)

501
Syntax error in parameters or arguments

502
Command not implemented

503
Bad sequence of commands

504
Command parameter not implemented

550
Requested action not taken: mailbox unavailable
(E.g., mailbox not found, no access)

551
User not local; please try

552
Requested mail action aborted: exceeded storage allocation

553
Requested action not taken: mailbox name not allowed
(E.g., mailbox syntax incorrect)

554
Transaction failed (Or, in the case of a connection-opening response, "No SMTP service here")

RFC-2821 defines the following additional

252
Cannot VRFY user, but will accept message and attempt delivery

Better explained codes:

SMTP Reply Codes

When issuing a command, the server will respond with one of the reply codes listed below. As said before, the text associated with the reply code can differ from each server; however, the syntax of the reply defaults to

In case of multiple lines, the syntax of the "text-only" lines is - . The last line is that of the default syntax, so the client understands the server is done with the reply.

The reply codes can be divided into five values for the first digit (out of 3):

1xy Positive Preliminary reply (only for Extended SMTP commands)
2xy Positive Completion reply (The command has been accepted)
3xy Positive Intermediate reply (There should be further information [i.e. DATA])
4xy Transient Negative Completion reply (Command Failed, but can be repeated)
5xy Permanent Negative Completion reply (Command Failed)

The detailed information of the reply codes is listed below

2xy Reply codes

System status, or system help reply (211)
This reply code is followed by information concerning the server, the server status, the server system, or server help.

Reply Code: 211
Issued Command(s): HELP
Standard Timeout: N/A (Server Default)

Help message (214)
This reply code is followed by information on how to use the receiver or the meaning of a command. Usually it provides a list of commands accepted by the server.

Reply Code: 214
Issued Command(s): HELP
Standard Timeout: N/A (Server Default)

Service ready (220)
The 220 reply code is used to confirm connection establishment. It is the primary command after making a TCP connection

Reply Code: 220
Issued Command(s): N/A
Standard Timeout: 5 minutes

Service Closing Transmission Channel (221)
After issuing the Quit command, the server replies with the 221 code, immediately closing the TCP connection. Therefore, this is the final reply code (unless the connection is terminated before closing the session).

Reply Code: 221
Issued Command(s): QUIT
Standard Timeout: N/A (Connection Closed)

Requested mail action okay, completed (250)
This is the most commonly used reply code when a command is accepted and executed without errors. After the 250 reply code the server waits until the next command is issued, or a timeout occurs.

Reply Code: 250
Issued Command(s): HELO, MAIL, RCPT, DATA, RSET, VRFY, NOOP
Standard Timeout: See command description

User not local; will forward to (251)
When the server receives a RCPT or VRFY command, it will try to verify the specified user with the local mailboxes. When the user doesn't exists or has a forward path, the server will reply with the 251 code saying it will accept the user and relay the message.

(Please refer to section 1.3.5 for more information about the 251 and 551 reply codes)

Reply Code: 251
Issued Command(s): RCPT, VRFY
Standard Timeout: 5 Minutes (RCPT command)

Cannot VRFY user, but will accept message and attempt delivery (252)
This code works the same as the 251 reply code; however, it will be issued only in response to the VRFY command.

Reply Code: 252
Issued Command(s): VRFY
Standard Timeout: N/A (Server Default)

3xy Reply codes

Start mail input; end with . (354)
Issued after the DATA command, the 354 code is used to state that more information is required, and thus the server is waiting for the message body.

Reply Code: 354
Issued Command(s): DATA
Standard Timeout: 2 Minutes (DATA command), 3 Minutes (DATA block), 10 Minutes (DATA Termination)

4xy Reply codes

Service not available, closing transmission channel (421)
This reply code is given when the server is temporarily unavailable for accepting connections. This would be the case when the server is in the process of shutting down. This code can be replied during the entire client session if unusual circumstances are encountered

Reply Code: 421
Issued Command(s): N/A
Standard Timeout: N/A (Connection Closed)

Requested mail action not taken: mailbox unavailable (450)
When a user mailbox is busy because of administrative work (i.e. backup), the 450 reply code is generated when the RCPT command is issued. It states that the message cannot be delivered to that user at this time. The client can repeat the command at a later time.

Reply Code: 450
Issued Command(s): RCPT
Standard Timeout: 5 Minutes (RCPT Command)

Requested action aborted: local error in processing (451)
This reply code specifies that an error has occurred while processing the command locally. However, the error is transient, allowing the user to repeat the command after an unspecified period of time.

Reply Code: 451
Issued Command(s): MAIL, RCPT, DATA
Standard Timeout: See command description

Requested action not taken: insufficient system storage (452)
The 452 reply code specifies that the SMTP server system has insufficient storage to process the message. Most SMTP server alerts the system administrator when this happens allowing them to solve the problem and thus giving the client the possibility to repeat the command after an unspecified period of time. This reply code can also be issued when there are too many recipients. See the RCPT command for further details.

Reply Code: 452
Issued Command(s): MAIL, RCPT, DATA
Standard Timeout: See command description

5xy Reply codes

Syntax error, command unrecognized (500)
This reply code is issued when the SMTP server doesn't recognize an SMTP command. It can be issued at any time during the client session. Note that all SMTP servers compliant to the RFC accept the standard commands necessary for sending an e-mail (HELO, MAIL, RCPT, DATA, QUIT). The 500 reply code is also issued when the command line is too long

Reply Code: 500
Issued Command(s): All
Standard Timeout: See command description

Syntax error in parameters or arguments (501)
When a command is recognized but doesn't comply to the specified parameters or arguments, the 501 reply code is returned. This reply code can be issued at any time during the client session. In default, it will be returned when the DATA, RSET or QUIT command have parameters or arguments while no EHLO extensions are available.

Reply Code: 501
Issued Command(s): All
Standard Timeout: N/A (Server Default)

Command not implemented (502)
The 502 Reply code is related to the 500 command with the only difference that this reply code is issued when the server does recognize the command, but didn't implement it, so it cannot be executed. Again, the 502 reply code may not be issued when handling the standard commands necessary for sending an e-mail.

Reply Code: 502
Issued Command(s): VRFY, EXPN, HELP
Standard Timeout: N/A (Server Default)

Bad sequence of commands (503)
When sending e-mail, a default sequence is specified (as shown in 2.2). Not complying with this sequence can result in the 503 reply code. When this code is returned, the server will wait for a new command, preserving the data already supplied.

Reply Code: 503
Issued Command(s): MAIL, RCPT, DATA
Standard Timeout: See command description

Command parameter not implemented (504)
There are a few commands which don't allow command parameters to be supplied. Ignoring this rule will result in a 504 reply code. Below is a list of commands on which this rule applies.

Reply Code: 504
Issued Command(s): HELO, VRFY, EXPN, HELP
Standard Timeout: N/A (Server Default)

Requested action not taken: mailbox unavailable (550) Although similar to the 450 reply code (1.3.3.2), there is one difference. When the 550 reply code is issued by the server, the mailbox or command is permanently unavailable. With the 450 reply code, the client can repeat the command at a later time. The 550 reply code is issued when a mailbox cannot be found, access is prohibited, or the command is rejected based on security/company policies.

Reply Code: 550
Issued Command(s): HELO, MAIL, RCPT, VRFY, EXPN
Standard Timeout: See command description

User not local; please try (551)
Although similar to the 251 reply code (1.3.1.6), the main difference between them is that the server will reject the address when returning a 551 reply code and attempt to deliver the message when returning a 251 reply code.

(Please refer to section 1.3.5 for more information about the 251 and 551 reply codes)

Reply Code: 551
Issued Command(s): RCPT, VRFY
Standard Timeout: See command description

Requested mail action aborted: exceeded storage allocation (552)
The 552 reply code is a remaining instance of the 821 RFC published in 1982. In this RFC, the 552 reply code was designed to alert clients exceeding the number of recipients allowed by the server. However, in the 2821 RFC, the 452 reply code became the appropriate command. Since there is a possibility that there are SMTP servers active that were designed on the 821 RFC, clients should treat the 552 reply code as a 452 temporary failure instead of permanently based on the 5xy logic.

Reply Code: 552
Issued Command(s): RCPT
Standard Timeout: 5 Minutes (RCPT command)

Requested action not taken: mailbox name not allowed (553)
The 553 reply code is issued when an e-mail address parameter of a command is invalid. This can occur because the syntax of the parameter is invalid or because of security/company policies.

Reply Code: 553
Issued Command(s): MAIL, RCPT, VRFY
Standard Timeout: See command description

Transaction failed OR No SMTP service here (554)
When connecting to a SMTP server, the server initiates an SMTP session. In this session the client can issue commands to the server. However, an SMTP server can formally reject an SMTP transaction. If so, the SMTP server will, instead of the normal 220 reply code upon establishing the connection, issue a 554 reply code. The server will maintain the SMTP session until a QUIT command is issued, the connection times out, or the client closed the connection. When receiving a command, with the exception of the QUIT command, after a 554 reply code has been issued, a server will reply with a 503 reply code (1.3.4.4).

Reply Code: 554
Issued Command(s): N/A
Standard Timeout: 5 Minutes

Detailed information about the 251 and 551 reply code
The reason these two reply codes are discussed here is because both deal with the Forward-Path of a mailbox. The Forward-Path can be used by companies or individuals to hide the original address of the user. However, when an SMTP server issues a 251 or 551 reply code, the original address will be revealed. Therefore, most SMTP servers have chosen not to implement these two codes returning a 250 or a 550 reply code instead. If SMTP servers did implement these codes, the server is obliged by the RFC to give users the possibility to disable their use. Also the RFC specifies that the SMTP server SHOULD not expect the client software to update the e-mail address repeating the command. Therefore, implementation of the 251 and 551 reply code within the SMTP client component isn't necessary.
Post a Comment
Related Posts Plugin for WordPress, Blogger...