Seven SPF mistakes that break mail quietly
Most broken SPF records look fine at a glance. These are the failure modes that pass visual inspection and still cost you delivery.
1. Two SPF records
Publishing a second v=spf1 TXT record, which usually happens when a new vendor's setup guide is followed literally rather than merged into the existing record, produces a permanent error. Receivers do not merge them. Merge the mechanisms into one record instead.
2. SPF on a CNAME'd or wrong name
The record belongs on the exact domain used in the envelope sender. Publishing it on www.example.com, or on a host that is a CNAME to somewhere else, means nothing checks it.
3. Exceeding ten lookups
Permerror, which DMARC counts as an SPF failure. Nothing in your mail client will tell you; only the reports will.
4. Using the SPF RR type
DNS once had a dedicated SPF record type (type 99). It was deprecated in 2014. Publish SPF as TXT, and delete any type 99 records still lying around.
5. Splitting the string wrong
A single TXT string caps at 255 characters. Longer records must be split into multiple quoted strings within one record, which resolvers concatenate with no separator. Some DNS UIs do this for you; some do not.
Correct splitting of one long record
"v=spf1 ip4:203.0.113.0/24 ip4:198.51.100.0/24 " "include:_spf.example.net -all"6. Authorising more than you meant
A wide ip4 range from a shared hosting provider authorises every other customer on that platform to send as you. Prefer the narrowest range the provider will commit to.
7. Forgetting the domains that never send
Parked domains and subdomains get spoofed precisely because nobody thinks about them. Publish a record that authorises nothing: v=spf1 -all.
Check every domain you own, not just the one on your business cards. Attackers read your DNS more carefully than you do.
More on SPF
What SPF actually does
SPF authorises servers, not messages, and it checks the envelope sender rather than the From address your recipient sees. That explains most SPF confusion.
Reading an SPF record, mechanism by mechanism
A walk through every mechanism and modifier you are likely to meet in a real SPF record.
The SPF ten-lookup limit, and how to stay under it
SPF evaluation is capped at ten DNS lookups. Exceed it and the result is permerror, which most receivers treat as a failure, including DMARC.