SendStreak logo

What are SMTP status codes?

SMTP status codes (also called reply codes) are three-digit numbers that an SMTP server returns in response to every command a client sends. They tell the client whether a command succeeded, failed temporarily, or failed permanently. Understanding these codes is essential for building reliable email sending - they determine when to retry, when to stop, and when something is misconfigured.

SMTP reply codes are defined in RFC 5321 and follow a structured pattern where the first digit indicates the general category of the response.

How SMTP status codes are structured

Every SMTP reply code is a three-digit number in the format XYZ:

  • First digit (X) - The result class:
    • 2XX - Success. The command was accepted.
    • 3XX - Intermediate. The server is waiting for more data.
    • 4XX - Temporary failure. The command failed, but the client should retry later.
    • 5XX - Permanent failure. The command failed and will not succeed on retry.
  • Second digit (Y) - The category:
    • X0Z - Syntax (general protocol-level responses).
    • X1Z - Information (status and help responses).
    • X2Z - Connection (channel-related responses).
    • X5Z - Mail system (mailbox and delivery responses).
  • Third digit (Z) - The specific condition within the category.

The reply code is always followed by a human-readable text message. For example: 250 OK or 550 5.1.1 The email account that you tried to reach does not exist. The text varies by server, but the numeric code is standardized.

Common SMTP status codes

Success codes (2XX)

Code Meaning When you see it
211 System status Response to a HELP or status request. Informational only.
220 Service ready The server’s greeting when you first connect. Example: 220 smtp.gmail.com ESMTP ready.
221 Closing connection The server’s response to QUIT. The session is ending normally.
235 Authentication successful Returned after a successful AUTH command. Your credentials were accepted.
250 Requested action completed The most common success code. Returned after EHLO, MAIL FROM, RCPT TO, and after the message is accepted.

Intermediate codes (3XX)

Code Meaning When you see it
334 Authentication challenge During AUTH negotiation. The server is asking for credentials (Base64-encoded username or password).
354 Start mail input Returned after the DATA command. The server is ready to receive the message body. End your message with a line containing only . (a period).

Temporary failure codes (4XX)

These indicate a problem that may resolve on its own. Your application should retry these with exponential backoff.

Code Meaning Common cause
421 Service not available The server is temporarily overloaded or undergoing maintenance. Retry after a delay.
450 Mailbox unavailable The recipient’s mailbox is temporarily unavailable - often due to rate limiting, a full mailbox, or a greylisting policy.
451 Local error in processing The server encountered an internal error. Not your fault - retry later.
452 Insufficient storage The server has run out of storage. Rare for well-maintained servers, but possible during traffic spikes.

Permanent failure codes (5XX)

These indicate a problem that will not resolve on retry. Your application should not retry these. Log the error and flag the recipient.

Code Meaning Common cause
500 Syntax error The server did not recognize the command. Usually a client bug.
501 Syntax error in parameters The command was recognized but the arguments were malformed. Check your MAIL FROM or RCPT TO format.
502 Command not implemented The server does not support this command.
503 Bad sequence of commands Commands were sent out of order (e.g., DATA before MAIL FROM).
504 Parameter not implemented A command extension or parameter is not supported by this server.
530 Authentication required The server requires AUTH before accepting mail. You forgot to authenticate.
535 Authentication failed Your username or password was rejected. Verify your credentials. For Gmail, make sure you are using an App Password, not your regular password.
550 Mailbox not found The recipient address does not exist, or the server is rejecting the message. This is the most common permanent failure.
551 User not local The recipient is not on this server. Sometimes includes a forwarding address.
552 Message size exceeded The message (including attachments) exceeds the server’s size limit.
553 Mailbox name not allowed The recipient address syntax is invalid.
554 Transaction failed A catch-all rejection. Often means the message was identified as spam or the server is refusing the connection.

Enhanced status codes

Modern SMTP servers also return enhanced status codes (defined in RFC 3463) alongside the basic three-digit code. These use a dotted notation like 5.1.1 and provide more specific information:

550 5.1.1 The email account that you tried to reach does not exist.

The enhanced code breaks down as:

  • First number - Class (same as the basic code: 2 = success, 4 = temporary, 5 = permanent).
  • Second number - Subject: 0 = other, 1 = addressing, 2 = mailbox, 3 = mail system, 4 = network, 5 = protocol, 7 = security.
  • Third number - Specific detail.

Common enhanced codes you will encounter:

Enhanced code Meaning
5.1.1 Bad destination mailbox address (user does not exist).
5.1.2 Bad destination system address (domain does not exist).
5.2.1 Mailbox disabled or not accepting messages.
5.2.2 Mailbox full.
5.7.1 Message rejected due to policy (spam filter, authentication failure, or blocklist).
5.7.23 SPF validation failed. The sending IP is not authorized by the domain’s SPF record.
4.7.0 Temporary authentication failure. Retry later.

Handling status codes in your application

The most important distinction is between temporary (4XX) and permanent (5XX) failures:

Temporary failures (4XX) - Retry with exponential backoff. Start with a 1-minute delay, then double it on each subsequent retry (1 min, 2 min, 4 min, 8 min, etc.). Stop after a reasonable number of attempts (e.g., 5-10 retries over 24 hours).

Permanent failures (5XX) - Do not retry. Log the error, remove the recipient from your active list, and investigate. A 550 on a transactional email means the address is invalid - continuing to send to it damages your sender reputation.

Authentication errors (535) - These are permanent but fixable on your end. Check your SMTP credentials, verify your authentication method, and ensure your account is in good standing with the provider.

Connection errors (421) - If you see these consistently, you may be sending too fast. Add delays between messages or reduce your connection concurrency.

Try SendStreak for Free now!