SMTP Enhanced Status Codes Explained
Understanding RFC 3463 codes for accurate bounce classification
What Are Enhanced Status Codes?
SMTP enhanced status codes (RFC 3463) extend the basic SMTP response format with detailed diagnostic information. The format is Class.Subject.Detail
Code Format Breakdown
X.Y.Z
- X = Class (2 = success, 4 = transient, 5 = permanent)
- Y = Subject (which part of the system)
- Z = Detail (specific error)
Class Codes
| Class | Meaning | Action Required |
|---|---|---|
| 2 | Success | None needed |
| 4 | Transient (temporary failure) | Retry later |
| 5 | Permanent failure | Remove from list |
Hard Bounce Codes (Permanent Failures)
Hard bounces indicate the email address is invalid or the recipient doesn't exist. Remove immediately.
| Code | Meaning | Action |
|---|---|---|
| 5.0.0 | Other address status | Investigate further |
| 5.1.0 | Other address status | Investigate further |
| 5.1.1 | Bad destination mailbox address | Remove immediately |
| 5.1.2 | Bad destination mailbox address system | Check domain, may be temporary |
| 5.1.3 | Bad destination mailbox address syntax | Remove immediately |
| 5.1.4 | Destination mailbox ambiguous | Validate address |
| 5.1.5 | Destination mailbox valid but not reachable | Soft bounce (retry) |
| 5.1.6 | Mailbox moved to spam folder | Reduce sending to this domain |
| 5.1.7 | Destination mailbox not valid | Remove immediately |
| 5.2.0 | Other or unknown mailbox status | Investigate |
| 5.2.1 | Mailbox disabled, not accepting messages | Remove immediately |
| 5.2.2 | Mailbox full | Retry after date in response |
| 5.2.3 | Message too large | Reduce email size |
| 5.2.4 | Mailbox temporarily unavailable | Retry later |
Soft Bounce Codes (Retryable Failures)
Soft bounces indicate temporary issues. Retry a few times before removing.
| Code | Meaning | Retry Strategy |
|---|---|---|
| 4.0.0 | Other address status | Retry in 1 hour |
| 4.1.0 | Other address status | Retry in 1 hour |
| 4.1.1 | Mailbox unavailable | Retry in 30 minutes |
| 4.1.2 | Mailing system not accepting messages | Retry in 1 hour |
| 4.2.0 | Mailbox status | Retry based on specific sub-code |
| 4.2.2 | Mailbox full | Retry in 24-48 hours |
| 4.2.3 | Message too large | Reduce content, retry |
| 4.3.0 | Mail system status | Retry in 1 hour |
| 4.3.1 | System not accepting network requests | Retry in 30 minutes |
| 4.3.2 | System busy | Retry in 15 minutes |
| 4.4.0 | Network problem | Retry in 5-15 minutes |
| 4.4.1 | Connection refused | Retry later |
| 4.4.2 | Routing server error | Retry later |
| 4.4.4 | Unable to route | Retry in 1 hour |
| 4.4.7 | Delivery time expired | Retry once more |
ISP-Specific Response Codes
Major ISPs use their own codes that don't follow RFC 3463 exactly:
Gmail Response Patterns
- "550 5.7.1" = Message blocked (spam or policy)
- "550 5.7.26" = Spam not accepted
- "421 4.7.0" = Try again later
- "450 4.7.1" = Temporary authentication failure
Outlook Response Patterns
- "550 5.550.63" = Message blocked as spam
- "550 5.550.65" = Inbound attachment blocked
- "550 5.550.66" = Inbound policy blocked
- "450 4.570.365" = Rate limit hit
Yahoo Response Patterns
- "421 4.31.80" = Service temporarily unavailable
- "550 5.7.1" = Spam detected
- "554 5.7.1" = Message blocked
Bounce Classification Logic
Use this decision tree to classify bounces correctly:
function classify_bounce(smtp_response):
if code starts with "5":
if code in [5.1.1, 5.1.3, 5.1.7, 5.2.1]:
return HARD_BOUNCE # Remove immediately
elif code in [5.2.2, 5.2.3]:
return SOFT_BOUNCE # Retry with adjustments
else:
return HARD_BOUNCE # Unknown permanent = remove
elif code starts with "4":
return SOFT_BOUNCE # Retry later
else:
return SOFT_BOUNCE # Any other response = retry
⚠️ Critical Rules
- Never retry a 5.1.1 (bad mailbox) - the address simply doesn't exist
- Never retry a 5.2.1 (mailbox disabled) - the account is closed
- Always retry 4.x.x codes - they're temporary
- After 3 soft bounce retries, convert to hard bounce