SPF Record Syntax: The Complete Reference (RFC 7208)
SPF Record Syntax: Mechanisms, Qualifiers, Modifiers, and Macros
SPF records follow a single shape: a DNS TXT record starting with v=spf1, followed by space-separated mechanisms and modifiers. This reference covers all eight mechanisms (all, include, a, mx, ptr, ip4, ip6, exists), the four qualifiers (+ - ~ ?), the two modifiers (redirect and exp), and the complete macro table. It details evaluation order, DNS lookup limits (10 per record), and placement rules, each with the relevant RFC 7208 section. A notable warning: the ptr mechanism is explicitly deprecated ('do not use') by the RFC, yet 1.4% of SPF-enabled domains still publish it.
The RFC itself concedes the name was 'poorly chosen': a -all inside an included record does not fail your outer record — a Fail, Softfail, or Neutral inside simply means 'no match here, keep going'.
- jedberg
I'm sorry this page needs to exist, it's partly my fault. I created the first "large scale" SPF record (for eBay and PayPal), and agreed that this was the best way to do it. I guess the people after me agreed too, because 20 years later it's still pretty much the same shape as when I made it!
But I don't have any regrets, the format was pretty straightforward and offered a lot of flexibility. The biggest issue was the parsing libraries handling all of the "include" statements correctly.
- YesThatTom2
SPF flattening is difficult to get correct and then you have to check it every so often to update it.
DNSControl automates this. https://docs.dnscontrol.org/language-reference/domain-modifi...
(It’s open source)
- dan_sbl
> SPF record syntax follows one shape:
The first six words do not scream "human written" to me.