Sub topic 15
Enforcement behavior and diagnosing failures
This chapter assumes you can read raw email headers and SMTP bounce messages, you know how SPF, DKIM, alignment, and DMARC work from the earlier chapters, and you can query DNS with dig. It covers what each provider does to non-compliant mail and how to work back from a symptom to a cause.
How enforcement shows up
Providers do not flip one switch. They ramp up enforcement, and each ramp produces a different symptom. Some details change over time, so check each provider's current sender documentation before you rely on a specific code.
| Provider | Typical sequence | What you see |
|---|---|---|
| Gmail | Temporary errors on a share of non-compliant traffic, then more rejections, then permanent rejection of mail that fails the requirements | `421`/`450` deferrals, later `550 5.7.x` bounces, and spam-folder placement |
| Yahoo | Deferrals and junk placement for unauthenticated or complained-about mail, with rejections for policy failures | `421 4.7.0` with a `TSS` code, or `554` policy rejections |
| Microsoft (Outlook.com, Hotmail, Live) | Non-compliant mail from senders above the daily threshold is routed to Junk, then rejected | `550 5.7.515` "does not meet the required authentication level" |
Microsoft applies its rules to its consumer mailboxes only. Microsoft 365 business tenants are filtered by other controls. A bounce from a corporate recipient on Microsoft 365 is probably not this enforcement.
Two points matter when you diagnose.
- Enforcement is per message and per sending identity. Your domain, your sending IP, and the DKIM signing domain each carry their own reputation. One misconfigured stream can fail while others pass.
- Temporary failures (4xx) are a warning. Your mail server will retry them, so the damage can look like delay or lower delivery rather than bounces. Treat a rise in deferrals as an early alert and fix the cause before it becomes a 5xx.
A triage order
Start with the symptom, then check the cheapest, most deterministic causes first. Authentication and DNS problems are binary and quick to confirm. Reputation problems are gradual and need data.
Reading the bounce
The SMTP reply has a basic code (421, 550), an enhanced status code (4.7.0, 5.7.26), and text. The enhanced code and the text name the cause. Group them by what they point to.
- Authentication failures. Text such as "unauthenticated", "does not pass authentication checks (SPF or DKIM)", "DMARC policy", or "does not meet the required authentication level" means you need to repair SPF, DKIM, or alignment. Gmail uses
5.7.26for unauthenticated mail. Microsoft uses5.7.515. Yahoo reports DMARC failures as554policy rejections. - Infrastructure failures. Text about a missing PTR record or reverse DNS points at the sending IP. Gmail uses
5.7.25for a missing PTR record. Fix this in your hosting or ESP settings, not in your domain's DNS. - Reputation and rate failures. Text such as "unusual rate of unsolicited mail", "likely unsolicited", or "temporarily deferred due to unexpected volume or user complaints" is a reputation signal. No DNS change fixes it. See the chapter on spam complaint thresholds.
A short script can bucket bounce lines from your mail logs so you can see which cause dominates.
import re
from collections import Counter
RULES = [
("authentication", re.compile(r"5\.7\.26|5\.7\.515|authenticat|DMARC|SPF|DKIM", re.I)),
("infrastructure", re.compile(r"5\.7\.25|PTR|reverse DNS|TLS", re.I)),
("reputation", re.compile(r"unsolicited|unexpected volume|complaints|4\.7\.0|4\.7\.28", re.I)),
]
def classify(line):
for label, pattern in RULES:
if pattern.search(line):
return label
return "other"
bounces = [
"550-5.7.26 This message does not pass authentication checks (SPF or DKIM)",
"550 5.7.515 Access denied, sending domain does not meet the required authentication level",
"550 5.7.25 The IP address sending this message does not have a PTR record",
"421 4.7.0 [TSS04] Messages temporarily deferred due to unexpected volume or user complaints",
]
print(Counter(classify(b) for b in bounces))Rule order matters because the patterns overlap. The 4.7.0 rule sits under reputation, so check an ambiguous line against the full text before you act on the label.
Reading the headers of a delivered message
A message that lands in the inbox or junk folder produces no bounce, so use the receiving mailbox's own verdict. Open the original message in a mailbox you control at each provider and read the Authentication-Results header.
Authentication-Results: mx.example.net;
spf=pass smtp.mailfrom=bounce.example.com;
dkim=pass header.d=example.com header.s=mail1;
dmarc=pass (p=NONE) header.from=example.comCheck these things in order.
- Each mechanism's result.
passis what you want.softfail,fail,neutral,temperror, andpermerroreach have a different meaning.permerroroften means an SPF record with more than 10 DNS lookups.temperrormeans the receiver could not complete a DNS lookup. - The domains. Compare
smtp.mailfrom(SPF identity) andheader.d(DKIM identity) withheader.from. A pass with a different domain does not help DMARC. In the sample above, DKIM passes withexample.com, so DMARC passes even though the SPF domain,bounce.example.com, differs from the From domain. - The selector.
header.s=mail1tells you which DNS record the receiver used. If a key was rotated and the old selector was removed, you seedkim=failwith a "no key" reason. - Body or header changes.
dkim=fail (body hash did not verify)means something altered the message after signing. Common causes are a footer added by a gateway, a link-tracking rewriter that runs after signing, or a mailing list.
Gmail's "Show original" view displays SPF, DKIM, and DMARC verdicts at the top. Yahoo and Outlook.com show the raw header with the same fields.
Confirming the DNS and network side
When the headers point to a missing or broken record, confirm what the world sees, not what your DNS panel shows.
dig +short TXT example.com
dig +short TXT mail1._domainkey.example.com
dig +short TXT _dmarc.example.com
dig +short -x 203.0.113.25Look for these faults:
- Two SPF records on the same name. SPF allows only one
v=spf1record, and two cause apermerror. - A DKIM key split across TXT strings incorrectly, or truncated by your DNS host.
- A DMARC record published at
example.cominstead of_dmarc.example.com. - A PTR record that does not resolve forward to the same IP (the forward-confirmed reverse DNS check). The
dig -xcommand shows only the reverse half, so also resolve the returned name and compare.
Common causes of junk placement with passing authentication
If all three checks pass and mail still goes to junk, authentication is not the cause. Look at these instead:
- A complaint rate near or above the thresholds in Postmaster Tools.
- A new or recently changed sending domain or IP with no history. Ramp volume gradually.
- A subscriber list with old addresses, which raises bounces and spam-trap hits.
- Missing or broken one-click unsubscribe, which pushes recipients to the spam button instead.
- Content or link problems, such as URL shorteners or mismatched link domains.
Change one variable at a time and compare results over several days, because provider reputation data lags.
Exercise
A marketing stream gets 550 5.7.515 bounces from Outlook.com recipients. Delivered copies at Gmail show spf=pass smtp.mailfrom=bounce.esp.example.net, dkim=pass header.d=esp.example.net, and dmarc=fail header.from=example.com. What is the cause, and what do you change?
Show answer
Both SPF and DKIM pass, but for the ESP's domain, not for example.com, so neither identity aligns with the From domain and DMARC fails. Microsoft rejects the mail for not meeting its authentication requirements. Configure custom DKIM signing at the ESP with a selector under example.com (and, if possible, a custom bounce domain under example.com). Publish the DNS records the ESP gives you, confirm with dig, then send a test and check that the header shows dkim=pass header.d=example.com and dmarc=pass.