SPF (Sender Policy Framework)
By Moe Ameen, founder of BILT · Published · Updated
SPF (Sender Policy Framework) is a DNS TXT record listing the servers allowed to send mail for your domain, so receivers can reject mail from servers not on the list.
Key takeaways
- SPF lists authorized sending servers in a DNS TXT record.
- Records may trigger at most 10 DNS lookups; going over causes a permanent error.
- Ending with -all asks receivers to fail unlisted servers; ~all only softfails them.
RFC 7208 defines SPF. A receiving server reads the domain in the envelope sender (the MAIL FROM address), looks up that domain's SPF record and checks whether the sending IP is authorized. The result is pass, fail, softfail, neutral or an error.
SPF checks the envelope sender, not the From address a person sees. That gap is why DMARC exists: it requires the domain SPF validated to align with the visible From domain.
How does an SPF record work?
The receiver looks up the TXT record on the envelope sender's domain and checks the connecting IP against the mechanisms in it.
A typical record reads v=spf1 include:_spf.google.com include:sendgrid.net -all. Each include points to another provider's list. RFC 7208 limits evaluation to 10 DNS-querying terms, and exceeding that returns a permerror, which many receivers treat like having no SPF at all.
What is the difference between -all and ~all?
-all returns fail for servers not listed, while ~all returns softfail, a weaker signal receivers should not reject on alone.
Use ~all while you are still finding every service that sends for you, then tighten to -all once your DMARC reports show all legitimate mail passing.
What SPF mistakes break email?
Publishing two SPF records, exceeding ten lookups, and forgetting a sending tool are the most common SPF failures.
Illustrative case: you add a CRM, a cold email tool and a helpdesk, each with its own include that pulls in two or three more lookups. The count passes ten, every message returns permerror, and outreach starts landing in spam. Flatten the record or move a tool to a subdomain.
Who is this for, and who should skip it?
Best for
- Every domain that sends mail, including each outside tool sending for you
- Telling receivers which servers are allowed, ideally ending the record in -all
Not ideal for
- Proving a message wasn't altered after sending; DKIM handles that
- Records that need more than ten DNS lookups and return a permanent error
What else do people ask?
Can a domain have two SPF records?
No. Merge all mechanisms into one v=spf1 record.
Is SPF enough on its own?
Google accepts SPF or DKIM for low-volume senders, but bulk senders need both plus DMARC.
Does SPF survive forwarding?
Often not, because the forwarding server is not in your record. DKIM usually survives better.
Where do I add an SPF record?
In your domain's DNS host as a TXT record on the root domain or the sending subdomain.
How do we know this?
We read RFC 7208 and Google's email sender guidelines on November 4, 2026.
Sources
- RFC 7208: Sender Policy Framework (SPF) (accessed November 4, 2026)
- Google Workspace Admin Help: Email sender guidelines (accessed November 4, 2026)
Related terms