SPF (Sender Policy Framework) is a DNS record listing which servers may send email using your domain in the envelope sender (the hidden "Return-Path").
An example
v=spf1 include:spf.protection.outlook.com include:_spf.smtp2go.com -all
This says Microsoft 365 and SMTP2GO may send, and everything else should fail.
The 10-lookup limit
Each include, a, mx, exists and redirect costs a DNS lookup, including the ones nested inside other providers' records. Past 10, receivers treat SPF as a permanent error, so it fails for everyone. Busy organisations with a CRM, a newsletter tool and a helpdesk hit this often. Flattening (replacing includes with the IP ranges they contain, kept up to date automatically) fixes it.
~all or -all?
-all (fail) is the stronger statement; ~all (softfail) is softer. With DMARC enforcing, the difference matters less, because DMARC decides what happens to failing mail. Either is fine; -all is cleaner once you're confident.
SPF and DMARC alignment
SPF checks the envelope sender, not the From address you see. Many services send with their own envelope domain, so SPF passes but doesn't align. That's why DKIM is usually the more reliable way to pass DMARC for third-party senders.
Common mistakes
- Two SPF records on one domain (only one is allowed).
- Exceeding 10 lookups.
- Forgetting a sender, such as a billing system or website contact form.
- Using
+all, which lets anyone send.