How to parse SMTP responses to identify hard and soft bounces?
Matthew Whittaker
Co-founder & CTO, Suped
Published 23 Jun 2025
Updated 16 Aug 2025
8 min read
When you send an email, a lot happens behind the scenes. Your email server communicates with the recipient's server using a protocol called SMTP, or Simple Mail Transfer Protocol. During this conversation, the recipient server sends back codes and messages, known as SMTP responses. These responses tell us whether the email was delivered successfully, temporarily delayed, or permanently rejected. Understanding and parsing these responses is crucial for effective email deliverability, especially when it comes to identifying hard and soft bounces.
Ignoring these bounce messages can severely impact your sender reputation, leading to more emails landing in the spam folder or even your domain being added to a blocklist (or blacklist). Properly categorizing bounces as either hard or soft allows you to take appropriate action, improving your email campaign performance and overall deliverability.
Understanding SMTP response codes
SMTP response codes are three-digit numbers that indicate the status of an email transaction. The first digit broadly categorizes the response, while the second and third digits provide more specific details about the outcome. For instance, a 2xx code generally means success, while 4xx and 5xx codes signal temporary or permanent failures, respectively. It is these latter two categories that we focus on for bounce management.
The key distinction lies in whether the error is transient or permanent. A 4xx code indicates a temporary issue, meaning the server might accept the email later. This is often associated with soft bounces. Conversely, a 5xx code signifies a permanent error, suggesting the email will never be delivered to that address. These are typically hard bounces. However, it is not always that straightforward.
Parsing these codes involves looking beyond just the initial digit, as the full response text often contains important context. Mailbox providers (ISPs) can offer their own custom messages, which sometimes makes automated parsing challenging. For example, a 4xx response like 'mailbox full' is usually a temporary soft bounce, but a 'connection timed out' after multiple retries might indicate a persistent problem that should be treated as a hard bounce.
To effectively parse SMTP responses, it's essential to analyze the entire response string, not just the numeric code. Some errors might appear to be temporary but can indicate a permanent issue after repeated attempts. This nuanced understanding is what separates effective bounce management from generic suppression.
Identifying hard bounces
A hard bounce signifies a permanent delivery failure. This occurs when the recipient's email address is invalid, the domain doesn't exist, or the email server has permanently blocked your messages (sometimes due to your IP or domain being on a blocklist or blacklist). When you receive a hard bounce, it is critical to remove that email address from your mailing list immediately to protect your sender reputation. Continuing to send emails to invalid addresses will signal to ISPs that you have poor list hygiene, which can lead to your emails being marked as spam or rejected entirely.
Common SMTP codes for hard bounces typically start with 5xx. Here are a few examples:
550: Mailbox not found, no such user here, or recipient rejected.
500: Syntax error, command unrecognized. This usually indicates an issue with the sending client.
554: Transaction failed or policy rejection. This can mean the email was identified as spam or the sending IP is blocked. You might be interested in troubleshooting soft bounces with 554 SMTP codes.
For a deeper understanding of these permanent errors, refer to our guide on what defines hard and soft bounces. Always implement a robust system to automatically manage hard bounced email addresses by removing them from your active lists. This is a fundamental step in maintaining good email deliverability.
Example hard bounce SMTP response
SMTP 550 Errorplaintext
550 5.1.1 <recipient@example.com>: Recipient address rejected: User unknown in virtual alias table
This 550 error clearly indicates that the recipient's email address does not exist. This is a permanent failure and the address should be suppressed.
Identifying soft bounces
Unlike hard bounces, soft bounces are temporary delivery failures. These can occur for various reasons, such as a recipient's mailbox being full, the email server being temporarily down, or the message size exceeding limits. The key characteristic of a soft bounce is that the issue is not permanent, and retrying the send after a delay might result in successful delivery.
Soft bounces are typically indicated by 4xx SMTP codes. Here are some common ones:
421: Service not available, closing transmission channel. This can be a temporary server overload.
451: Requested action aborted: local error in processing. Often means the recipient's server encountered a transient issue.
452: Requested action not taken: insufficient system storage. This usually means the recipient's mailbox is full.
For soft bounces, the strategy is different. Instead of immediate suppression, email service providers typically implement retry logic for a certain period. However, if a soft bounce persists over multiple retries, it might indicate a more permanent problem, and the address should then be treated like a hard bounce and suppressed. Understanding how ESPs manage these soft bounces and codes is key to refining your own bounce handling. You can also learn how to tell if soft bounces were eventually delivered.
Example soft bounce SMTP response
SMTP 452 Errorplaintext
452 4.2.2 The recipient's mailbox is full and cannot accept messages at this time. Please try again later.
This 452 error explicitly states a temporary condition (mailbox full) and advises retrying. This confirms it is a soft bounce.
Parsing methods and challenges
Parsing SMTP responses for bounces effectively often involves programmatic solutions. While manual inspection of logs can be done, it's not scalable for large volumes of email. Many email service providers (ESPs) offer built-in bounce processing, but if you're sending directly or managing your own mail servers, you'll need to implement your own parsing logic. This usually involves analyzing raw SMTP logs or non-delivery reports (NDRs).
Regular expressions (regex) are a common tool for parsing these logs. You can create patterns to match specific SMTP codes and their associated text descriptions. However, the challenge lies in the sheer variety of bounce messages. Different mail servers and spam filters may return unique, non-standard text strings for the same underlying issue. This means a simple regex matching 550 User unknown might miss a variation like 550 Recipient invalid. A comprehensive parsing solution needs to account for these variations.
To address this complexity, some email deliverability resources, like the SMTP Field Manual, compile large datasets of real-world SMTP error messages. This can be invaluable for building robust parsing rules or training machine learning models to accurately classify bounces. Additionally, some sophisticated systems might use a combination of SMTP codes, the text message, and historical sending data to make more informed decisions about bounce classification, especially for ambiguous 4xx responses.
Understanding these SMTP response codes is a core aspect of email deliverability, providing insight into email bounce management. While the initial 4xx or 5xx code provides a quick indication, a truly effective parsing strategy delves deeper into the full SMTP message, enabling more accurate bounce classification and better email hygiene. You can get a better handle on these issues by learning what different SMTP bounce codes mean for deliverability.
Manual review
Process: Human analysis of individual bounce messages in logs.
Accuracy: High for complex, ambiguous cases due to human interpretation.
Scalability: Very low, impractical for even moderate sending volumes.
Effort: Extremely high, time-consuming and prone to human error over time.
Automated parsing
Process: Programmatic analysis using regex, rule-sets, or AI.
Accuracy: High for known patterns, can struggle with new or obscure messages.
Scalability: Excellent, can handle millions of bounces efficiently.
Effort: High initial setup, low ongoing maintenance for routine cases.
Views from the trenches
Best practices
Actively monitor all SMTP responses, not just the initial code, for comprehensive bounce classification.
Implement automated suppression for hard bounces to protect your sender reputation immediately.
Use a tiered retry strategy for soft bounces, re-evaluating their status after multiple failed attempts.
Common pitfalls
Treating all 4xx errors as purely temporary, missing persistent issues that become effective hard bounces.
Not removing hard bounce addresses promptly, leading to negative impacts on your email sender score.
Overly simplistic regex patterns that fail to capture the nuanced variations in SMTP error messages.
Expert tips
Consider integrating external bounce data sources to enhance your parsing rules and improve accuracy.
Segment your bounced email lists by bounce type and frequency to identify systemic issues with specific domains.
Utilize DMARC reports to get aggregated data on email authentication failures, which can sometimes correlate with bounces.
Expert view
Expert from Email Geeks says that while any 5xx response code should technically be considered a hard bounce, the nuances often mean some repeated 4xx responses, like 'server busy', should also be treated as hard bounces.
2021-06-02 - Email Geeks
Marketer view
Marketer from Email Geeks says that separating 5xx from 4xx responses and then manually reviewing specific cases, especially by receiver like Yahoo, can help clarify what is truly happening.
2021-06-02 - Email Geeks
Maximizing email deliverability through bounce parsing
Effectively parsing SMTP responses is more than a technical exercise, it is a cornerstone of good email deliverability. By accurately distinguishing between hard and soft bounces, you can maintain clean mailing lists, preserve your sender reputation, and ensure your legitimate emails reach their intended recipients. While it requires attention to detail and robust parsing logic, the payoff in improved deliverability and campaign performance is substantial. This proactive approach helps you avoid being put on an email blocklist or blacklist, which can have significant negative impacts on your outreach efforts.