SPF (Sender Policy Framework)
By Carlos Gil, Founder & Editor, The Best Network · Updated
A DNS record that lists which servers are allowed to send email on behalf of your domain.
SPF is the record most people set up once and then quietly break. Add one more sending tool, publish a second record or pass ten DNS lookups, and SPF fails for every message you send.
Key takeaways
- SPF (RFC 7208) is one TXT record listing the servers allowed to send for your envelope sender domain.
- Two SPF records, or more than 10 DNS lookups, produce a permanent error and SPF fails.
- Google and Yahoo require SPF or DKIM from every sender, and both from bulk senders.
- SPF never checks the visible From address, which is why DMARC alignment exists.
SPF (RFC 7208) is a TXT record on your domain that lists the servers allowed to send mail for it, for example v=spf1 include:_spf.google.com ~all. The receiving server checks the connecting IP address against the SPF record of the envelope sender domain (the Return-Path, also called MAIL FROM), not the From address your subscribers see. That difference is why SPF alone does not stop spoofing of your visible From domain, and why DMARC alignment exists.
How to set up SPF
Publish one TXT record that starts with v=spf1 on the domain your platform uses as its envelope sender. Each service that sends for you (newsletter tool, help desk, invoicing app) usually gives you an include: value to add. End the record with ~all (soft fail) or -all (fail). Google and Yahoo both require SPF or DKIM from every sender, and both SPF and DKIM from bulk senders.
Check it by opening a test message in Gmail, choosing Show original and looking for SPF: PASS, or by running your domain through any SPF lookup tool.
Common SPF mistakes
Publishing two SPF records. RFC 7208 allows one per domain; two produce a permanent error, so SPF fails for every message.
Going over 10 DNS lookups. The include, a, mx, ptr and exists mechanisms and the redirect modifier each count toward a limit of 10, and lookups inside nested includes count too. Stacking services pushes many domains past the limit, which also produces a permanent error. Remove services you no longer use before adding new includes.
Relying on SPF alone. Forwarded mail arrives from the forwarder's IP and can fail SPF, and SPF never checks the visible From address. DKIM and DMARC cover both gaps.
What Google documents for SPF
Google's setup page gives the record for a domain that sends only through Google Workspace: v=spf1 include:_spf.google.com ~all. It says each domain needs its own SPF record and so does each subdomain, so a record on example.com doesn't cover news.example.com. Google also caps a record at 10 include: tags and warns that SPF can take up to 48 hours to start working after you publish it.
That leads to the mistake behind many failing newsletters: the platform sends from a subdomain, and nobody published SPF there. To check yours, find the envelope sender domain in a test message (the Return-Path header), look up SPF on that exact name, count every lookup including nested includes, and repeat the check whenever you add a tool that sends as you.
Audit the record every time you add a tool that sends as you, because SPF fails silently and your subscribers are the ones who notice.
SPF (Sender Policy Framework): FAQ
Can a domain have two SPF records?
No. RFC 7208 allows one SPF record per domain. Publishing two produces a permanent error, so SPF fails for every message. Merge all your senders into a single v=spf1 record.
What is the difference between ~all and -all in SPF?
~all is a soft fail: mail from servers not listed is accepted but treated as suspicious. -all is a hard fail: those servers are not allowed. Both are valid endings; -all is stricter.