Email authentication
What is SPF?
SPF is a DNS TXT record that lists the servers and services allowed to send email for your domain. Receivers compare the connecting IP with that list and use the result as one input into spam and DMARC decisions.
SPF in one minute
An SPF record starts with v=spf1 and then lists mechanisms: ip4, ip6, include, a, mx, ptr, exists, redirect and all. Each mechanism can have a qualifier such as +, -, ~ or ?. The record ends with an all mechanism that defines the default result.
SPF is checked against the envelope sender, also called the return-path, not the visible From header. That is why SPF alone is not enough for DMARC; alignment with the From domain is what matters there.
The 10-lookup limit
SPF allows at most 10 DNS-querying terms per check. include, a, mx, ptr, exists and redirect count. Nested includes count too, which is why a record with a few marketing platforms can exceed the limit without looking large.
When the limit is exceeded, the result is permerror. Receivers may treat that as a failure, and DMARC can fail even though every individual sender is legitimate. The fix is to remove unused includes, replace includes with explicit IPs, or flatten the record.
The all qualifier
-all means fail: the IP is not authorised. ~all means softfail: suspicious but often accepted. ?all means neutral: no assertion. +all means pass everything, which defeats the purpose and should not be used on a public domain.
Most domains should aim for -all after they have confirmed every legitimate sender. ~all is a reasonable transition state. +all is a red flag in any audit.
Common SPF mistakes
Multiple SPF records are invalid. If two TXT records start with v=spf1, receivers may return permerror. Keep one record and merge the mechanisms.
Other frequent problems are a missing include for a new email provider, an include that no longer resolves, a ptr mechanism that is slow and unreliable, and a record that grows every time a new SaaS tool is added.
Frequently asked questions
What does -all mean?
It means fail. Any sender not listed by the record is not authorised, and the receiver should treat the message as an SPF failure.
Why does my SPF record return permerror?
Usually because it exceeds the 10 DNS-lookup limit, contains a syntax error, or has multiple v=spf1 records.
Does SPF protect the From header?
Not by itself. SPF checks the envelope sender. DMARC adds alignment with the visible From domain.
Can I have two SPF records?
No. RFC 7208 allows one SPF record per domain. Merge the mechanisms into a single TXT record.