What are SMTP codes and what do they do?
In a perfect world, each time you send an email the recipient would receive it almost instantaneously and there would be no errors. But in the real world, not all emails get delivered. Things happen. And when a message isn’t delivered to the expected location, you need a way to figure out what happened. That’s where SMTP codes come into play. They are three digits code responses from a mail server that tell you the status of a message sent.
How does SMTP work?
SMTP stands for Simple Mail Transfer Protocol as described in the RFC 5321: Simple Mail Transfer Protocol. Your mail client talks to the SMTP server using this clean and simple procedure to get email from one place to another. Think of SMTP as your local postal service and sorting office ensuring your mail gets to the right location and person. And each time an email is sent using SMTP the receiving server will respond with an SMTP code.
Are all SMTP codes bad?
No. This is because not all SMTP codes indicate a failure has occurred. For example, an SMTP response code 250(2.5.0) means the message was accepted and the delivery action was complete. We’ll discuss more on that later. But most do not notice SMTP codes until they realize that a message hasn’t been delivered. It’s then that those codes become valuable because its the bridge to a solution.
How are response codes generated and what do they mean?
A mail server will reply to every request a client(such as your email program) makes with a return code. This code consists of three numbers. But for this article, we’ll focus on the first digit as it’s generally the most important.
The first number tells whether the server accepted the command and if it could handle it. There are five possible values:
1: The server has accepted the command, but does not yet take action. A confirmation message is required. Currently, this is not used.
2: The server has completed the task successfully.
3: The server has understood the request, but requires further information to complete it.
Note: SMTP Codes that start with 2 or 3 are typically general response codes.
4: The server has encountered a temporary failure. If the command is repeated without any change, it might be completed. Mail servers can use such temporary failures to keep untrusted senders at bay.
5: The server has encountered a more permanent error. Trying again should produce the same result.
Common SMTP error codes
The most common SMTP error code when sending email is 550.
SMTP error 550 is a generic error message. Put plainly, it means that the email could not be delivered.
An SMTP error 550 delivery failure can happen for a variety of reasons. And while the error code 550 itself tells you nothing about the cause of failure, many an SMTP server includes an explanatory message with the error code. This is common to see in Postmark. For example, you may receive a 550 error that says:
Final-Recipient: email@example.com Action: failed Status: 5.7.1 ( delivery not authorized) Remote-MTA: dns;mx6.mail.icloud.com ( xx.xx.x.xxx) Diagnostic-Code: smtp;550 5.7.1 Message rejected due to local policy. Please visit https://support.apple.com/en-us/HT204137 X-PowerMTA-BounceCategory: policy-related
We try to include as much detail as possible when a messages bounces to minimize friction when troubleshooting.
Often, an email could not be delivered because it has been blocked as spam, either through an analysis of its contents or because the sender—or sender's network—is listed as a probable source of spam in a DNS blacklist. Some mail servers check for links to malware as well and return an error 550. SMTP error 550 codes for these cases might look like the following:
- 550 5.7.1: Service unavailable: client[###] blocked using ###(Exchange Server)
- 550 5.7.1: Message rejected as spam by Content Filtering(Exchange Server)
- 550 This message was classified as SPAM and may not be delivered
- 550 High probability of spam(Gmail)
- 550 5 2 1 mail from refused spam site
- 550 Message contained unsafe content
What can you do? If possible, try to contact the recipient by another method and let them know the full error you are getting when trying to reach them. If the error message points to a specific blacklist or spam filter, you can contact the list or filter administrator.