
How SPF works
SPF (Sender Policy Framework) lets you list the servers allowed to send mail for your domain in a DNS TXT record. A receiving server takes the domain from the envelope sender, the Return-Path, reads its SPF record and checks whether the connecting IP is on the list. The final all rule decides what happens to mail from servers not on the list.
Each include, a, mx, ptr, exists and redirect costs one DNS lookup, and the lookups inside nested includes count toward the same total. Past 10 lookups the receiver stops with a permerror, and mail from your domain fails SPF even when it comes from an allowed server. The checker above adds up lookups across all levels of the include tree.
Reasons to run an SPF check
- Verify the SPF record after you connect Google Workspace, Microsoft 365 or a newsletter service
- Find out why mail from a new sending service fails SPF or lands in spam
- Merge two SPF records that different providers asked you to publish
- Trim a record that grew past 10 DNS lookups
SPF record syntax: mechanisms, qualifiers and modifiers
An SPF record is one line of terms separated by spaces, and it must start with v=spf1. Mechanisms match the sending IP. ip4:203.0.113.0/24 and ip6:2001:db8::/32 list addresses and cost no DNS lookups. a and mx match the addresses of the domain's A or MX hosts, include:_spf.google.com runs the SPF check of another domain, and exists and the deprecated ptr cover rare cases. Each of these five costs one lookup. all matches any sender and goes last. A qualifier in front of a mechanism sets the result on a match: + pass (the default), - fail, ~ softfail, ? neutral. The modifier redirect=_spf.example.com hands the check to another record and costs one lookup; receivers ignore it when the record has an all term. A receiver returns permerror on a term it does not recognize, such as the typo inlcude:. This checker skips unknown terms, so the typo shows up as a missing branch in the include tree and a lower lookup count.
SPF record examples for Google Workspace, Microsoft 365 and bulk senders
Google Workspace alone: v=spf1 include:_spf.google.com ~all. Microsoft 365 (Office 365): v=spf1 include:spf.protection.outlook.com -all. SendGrid uses include:sendgrid.net, Mailgun include:mailgun.org and Amazon SES include:amazonses.com. Zoho Mail's setup guide gives include:zohomail.com, or a regional domain such as zohomail.eu for accounts in the EU data center. A domain with Google Workspace for staff mail, SendGrid for newsletters and its own server at 203.0.113.10 needs one combined record: v=spf1 ip4:203.0.113.10 include:_spf.google.com include:sendgrid.net ~all. Amazon SES, Mailgun and SendGrid often send with a Return-Path on a subdomain such as bounce.example.com or mg.example.com. Receivers check SPF on that subdomain, so you publish the provider's record (or the CNAME it gives you) there, and the root record may not need that include at all. Compare each value with your provider's DNS setup page before you publish.
SPF check results: pass, fail, softfail, neutral and permerror
A receiver ends the SPF check with one result. pass means the IP matched a term with the + qualifier. fail means it matched a - term, usually -all, and many receivers reject the message. softfail comes from ~all: the receiver accepts the mail and may route it to spam. neutral comes from ?all and carries no verdict. none means the domain has no SPF record. permerror means the record is broken: two v=spf1 records, more than 10 lookups or a term the receiver cannot parse. temperror means a DNS timeout or server error. The checker above shows which all rule your record ends with and follows redirect when the record has no all term.