SPF, the Sender Policy Framework, is a DNS TXT record that lists the servers allowed to send email for your domain. When a message arrives, the receiving server looks up the SPF record of the domain in the envelope sender and checks whether the connecting IP address is on the list. SPF is defined in RFC 7208.
How SPF works
- Your sending service connects to the recipient’s server and gives an envelope sender with
MAIL FROM:<bounces@send.acme.com>. This is the Return-Path, not the From line people read. - The receiver fetches the TXT record at
send.acme.comthat starts withv=spf1. - It evaluates the mechanisms left to right (
ip4,ip6,a,mx,include) until one matches the connecting IP. - It returns a result:
pass,fail,softfail,neutral,none,temperrororpermerror.
RFC 7208 also recommends checking the HELO name, and requires the MAIL FROM check when the HELO check gives no definite result.
Example SPF record
send.acme.com. TXT "v=spf1 include:amazonses.com ~all"
| Part | Meaning |
|---|---|
v=spf1 |
This is an SPF record |
include:amazonses.com |
Also allow the servers in Amazon SES’s SPF record |
~all |
Anything else is a softfail |
A domain that sends from Google Workspace and an email API might publish v=spf1 include:_spf.google.com include:amazonses.com ~all on the root domain.
The 10-lookup limit
RFC 7208 section 4.6.4 caps the mechanisms that need a DNS query (include, a, mx, ptr, exists and redirect) at 10 per check. Go over and the result is permerror, which most receivers treat as a failure. Each include can pull in more lookups of its own, so a record with five includes can easily exceed the limit. The SPF too many lookups guide shows how to fix it.
Why it matters for app email
Gmail requires SPF or DKIM from every sender, and both, plus DMARC, from bulk senders (Google sender guidelines). For DMARC to pass on SPF, the envelope sender domain must align with the visible From domain, which is why providers ask you to put the bounce domain on a subdomain of your own, such as send.acme.com.
Common mistakes
- Two SPF records on the same name. Merge them.
- Too many includes, breaking the 10-lookup limit.
- Using
+all, which authorizes the whole internet. - Adding the provider to the root domain when the provider sends with a custom MAIL FROM subdomain. The record must be on the domain that appears in MAIL FROM.
- Relying on SPF alone. It breaks on forwarding, so pair it with DKIM.
Check your record with our tools, and follow the SPF record guide for a full setup.
How Mailcandor handles it
When you add a domain, Mailcandor gives you the SPF record for send.<domain> and its deliverability coach checks that it resolves.