Day 4 · Deliverability & spam
Email troubleshooting: reading headers, bounce codes and a playbook
Course contents
Every email problem looks unique when it lands in the ticket queue, and almost all of them yield to the same method: find where along the path the message stopped, then read what the system at that point says about it. This lesson gives you the method, the evidence to collect, the error codes you will see most, a playbook for the classic tickets, and a script that turns a wall of headers into a readable path.
The method: split the path
A message passes through a chain of systems, each of which either takes responsibility or hands back an error (lesson 1):
sender's app → submission server → (queue) → recipient's MX → filters → mailbox → recipient's app
Ask, in order, and stop at the first “no”:
- Did it leave the sender’s app? Is it in Sent, in the Outbox, or still a draft? Did the app show an error?
- Did the submission server accept it? Its log has a queue ID for it, or the app got an error such as
535(bad credentials) or554 5.2.252 SendAsDenied. - Did the sending server deliver it? Its log shows
status=sentwith the remote server’s250reply and queue ID, ordeferredwith a temporary error, orbouncedwith a permanent one. - What did the receiving system do with it? Inbox, spam folder, quarantine, a rule that moved or forwarded it, or silent discard. This is visible only on the receiving side: the recipient’s spam folder, the admin’s message trace or quarantine, the headers of the delivered copy.
The proof that hands responsibility over is the remote server’s 250 ... queued as XYZ. Once you have it, the problem is on the receiving side, and the receiving side’s admin can find the message with that ID or the Message-ID.
The evidence to collect
| Evidence | Where | What it tells you |
|---|---|---|
| The full headers of the delivered message (or its bounce) | Gmail: ⋮ → Show original; Outlook: File → Properties → Internet headers; Apple Mail: View → Message → All Headers | The path, the time at each hop, the authentication results, the filters’ verdicts |
| The bounce message (DSN) | Sender’s inbox | Who refused, the code, and the remote server’s exact words (Diagnostic-Code) |
| Logs of your own MTA | /var/log/mail.log, ESP activity logs and webhooks | Accepted, sent, deferred, bounced, with queue IDs |
| Message trace | Microsoft 365: Exchange admin center → Mail flow → Message trace; Google Workspace: Admin console → Reporting → Email log search | What the provider did with a message, including spam verdicts and rules |
| DNS | dig | MX, SPF, DKIM, DMARC, PTR, MTA-STS as the world sees them right now |
| Reputation dashboards | Google Postmaster Tools, Microsoft SNDS, blocklists | Whether the problem is your reputation rather than one message |
Always ask the user for the exact error text, the time, the sender and recipient addresses, and a copy of the bounce or the message as an attachment (.eml), not a screenshot. Screenshots hide the headers, and the headers are where the answers are.
Reading headers fast
Read a header block in this order:
- Authentication-Results (the receiver’s verdict, near the top):
spf=,dkim=,dmarc=, and the domains they apply to (smtp.mailfrom,header.i/header.d,header.from). Mismatched domains explain most DMARC failures. - Received headers, from the bottom up: where the message entered, every hop, and the time stamps. A big gap between two hops shows where the delay happened.
- Spam verdicts:
X-Spam-Status(SpamAssassin),X-Spamd-Result(Rspamd),X-Forefront-Antispam-ReportandX-Microsoft-Antispam(Microsoft:SCL,SFV,BCL),ARC-Authentication-Results(what earlier hops saw). - Identity headers: From, Reply-To, Return-Path, Message-ID, and whether they make sense together.
Google’s free Admin Toolbox Messageheader and similar tools from Microsoft and others parse headers for you. Use them, but learn to read headers yourself first: tools hide the details that make the difference.
The error codes you’ll see most
The class (4 or 5) tells you temporary or permanent; the enhanced code and the text tell you why. Big providers write useful texts and link to help pages, so read the whole line.
| Code | Typical text | Meaning and fix |
|---|---|---|
550 5.1.1 | The email account that you tried to reach does not exist / User unknown | Typo or deleted mailbox. Fix the address; suppress it if it’s on a list |
550 5.1.10 | RESOLVER.ADR.RecipientNotFound (Microsoft) | Same: no such recipient at Microsoft 365 |
552 5.2.2 / 452 4.2.2 | Mailbox full / over quota | The recipient must clean up; temporary versions retry |
552 5.3.4 | Message exceeded size limits | Send a link instead of the attachment |
550 5.7.1 | Message rejected… likely unsolicited / blocked by policy | Spam or policy decision; check content, reputation, blocklists |
550 5.7.25 (Gmail) | The sending IP address doesn’t have a PTR record | Set reverse DNS (lesson 5) |
550 5.7.26 (Gmail) | Unauthenticated email… is not accepted due to domain’s DMARC policy / sender is unauthenticated | DMARC failure or no authentication; fix alignment (lesson 10) |
550 5.7.27 / 5.7.30 (Gmail) | Didn’t pass SPF / DKIM authentication | Fix that mechanism for the sender |
421 4.7.28 (Gmail) | Unusual rate of email / unsolicited mail | Rate limited for reputation; slow down, clean lists, check complaints |
421 4.7.0 (Gmail) | TLS required | Enable TLS on the sending server |
550 5.7.515 (Outlook.com) | Sending domain does not meet the required authentication level | Microsoft’s bulk sender requirements: SPF, DKIM and DMARC |
451 4.7.650 (Outlook.com) | Temporarily rate limited due to IP reputation | Reputation problem; check SNDS, slow down |
550 5.7.1 ... (S3150) (Outlook.com) | Part of their network is on our block list | Microsoft blocks the IP; use their delisting form after fixing the cause |
550 5.7.606 (Microsoft 365) | Access denied, banned sending IP | The IP is on Microsoft’s block list; request delisting at their sender portal |
550 5.7.520 (Microsoft 365) | Your organization does not allow external forwarding | The tenant’s outbound policy blocks automatic forwarding (on purpose, usually) |
554 5.2.252 (Microsoft 365) | SendAsDenied | The user lacks permission to send as that From address |
550 5.7.60 (Microsoft 365) | SMTP; Client does not have permissions to send as this sender | Same idea, for SMTP AUTH clients |
554 5.7.1 | Service unavailable; Client host blocked using zen.spamhaus.org | Blocklisted IP; look it up, fix, delist |
421 4.7.0 / 450 4.7.1 | Greylisted / try again later | Normal; your server retries. Only a problem if it never succeeds |
530 5.7.0 / 535 5.7.8 | Must issue STARTTLS first / authentication failed | Client configuration: TLS mode, credentials, OAuth |
The playbook
“I didn’t receive an email from X.”
- Check spam, quarantine (Microsoft 365: Defender → Quarantine), and the user’s rules.
- Message trace / email log search on your side for the sender’s address in that time window. Not there? It never reached your servers.
- Ask the sender for the bounce or their log line. A
250from your MX means you have it; a bounce tells you why you refused it. - Check your MX records, MX availability, and (if you enforce MTA-STS) that your certificates are valid.
“My email to X bounced.” Read the Diagnostic-Code in the bounce and match it to the table above. Address problems are fixed by the sender; policy and authentication problems are fixed by whoever owns the sending domain; reputation problems need the reputation lesson.
“Our emails go to spam.” Go through lesson 12 in order: headers of a message that went to spam (Authentication-Results first), then reputation (Postmaster Tools, SNDS, blocklists), then content and list practices. Find out whether it’s all recipients at one provider (reputation or authentication), some recipients (engagement or personal filters), or one message type (content).
“Email is slow.” Get headers of a delayed message and compute the delays per hop, as in the lab. Sender queue? Greylisting? A filter that took minutes? A recipient server that deferred?
“I can’t send.” Get the exact error from the app. Check the server name, port and TLS mode (465 implicit, 587 STARTTLS), the authentication method (OAuth vs password, app passwords), and whether the provider blocked basic authentication or the account is locked for sending spam.
“We stopped receiving all email.” The urgent one. Check, in this order: dig MX from outside (did someone change DNS? did the domain expire?), whether the MX answers on port 25 (swaks --to postmaster@yourdomain --server mx-host --quit-after RCPT), certificates (expired certificate with MTA-STS enforced), disk space and queues on your own servers, and the provider’s service status page.