The Sender Policy Framework (SPF) is an email authentication method that lists the servers allowed to send email on behalf of your domain.
SPF makes it harder to use your domain for spoofed mail and helps your messages get delivered properly. Receiving mail servers check your SPF record to see whether a message that appears to come from you really came from an authorised server.

How does SPF work?
When a mail server receives a message, it looks at the IP address of the sending server and the domain of the envelope sender (Return-Path). It then reads that domain's SPF record from DNS and checks whether the sending IP is on the list. The result, pass, fail, softfail or neutral, is written to the message headers and used in the spam decision.
The domain SPF checks is the envelope address, not the "From" address the recipient sees. So SPF on its own can't stop forged From addresses; DMARC fills that gap.
What should an SPF record look like?
An SPF record is a single TXT record on your domain. An example:
v=spf1 a mx ip4:203.0.113.25 include:_spf.google.com ~all
An SPF record always starts with v=spf1. This marks the SPF version; it's the only version in use today. The mechanisms that follow are evaluated left to right and the first match wins.
| Mechanism | Meaning |
|---|---|
a | The server in the domain's A record may send. |
mx | The servers in the MX records may send. |
ip4 | The given IPv4 address or block may send (ip4:203.0.113.0/24). |
ip6 | The given IPv6 address or block may send. |
include | Includes another domain's SPF rules. Used to authorise services you don't run yourself, such as Google Workspace or Microsoft 365. |
exists | Matches if the given name resolves. For advanced use. |
redirect= | Hands SPF evaluation over entirely to another domain. Used when several domains share the same rules. |
all | All servers not matched above. Always comes last. |

SPF for common services
Every service you send mail through has to be combined into one record. Common values:
| Service | Part to add |
|---|---|
| Google Workspace | include:_spf.google.com |
| Microsoft 365 | include:spf.protection.outlook.com |
| Zoho Mail | include:zoho.com (EU: include:zoho.eu) |
| Fastmail | include:spf.messagingengine.com |
| Your own server / hosting | a, mx or ip4:server-ip |
For example, if you send mail both through Google Workspace and from your hosting server (a contact form on your website, say):
v=spf1 a mx include:_spf.google.com ~all
Newsletter services (Mailchimp, SendGrid, Brevo and the like) usually use their own domain as the envelope sender and ask you for DKIM or CNAME records rather than SPF. Check what the service's documentation asks for; adding needless includes wastes the 10-lookup limit.
-all or ~all?
The qualifier at the end of the record says what to do with mail from a server that isn't listed: -all means a hard fail, ~all a soft fail.
With -all, mail from a server not defined in the record is treated as unauthorised and not delivered.
With ~all, you're saying your record may not cover every sending server. When mail comes from another server, the receiving system decides whether to accept it; it's usually marked as spam.
Your SPF record should be strict enough that your domain can't be used for spoofed mail. If you're sure every sending service is in the record, we recommend -all. For a new setup, it's safer to start with ~all for a few weeks, see from your DMARC reports which servers send mail, and then move to -all.
?all (neutral) gives no protection at all, and +all lets every server in the world send mail as you. Don't use either.
The 10 DNS lookup limit
The SPF standard (RFC 7208) allows at most 10 DNS lookups while evaluating an SPF record. include, a, mx, exists and redirect each count as one; includes inside included records add to the total too. ip4, ip6 and all need no lookup.
When the limit is exceeded the result is permerror, and receiving servers treat your SPF as invalid. It's a common problem for companies using several services at once. Ways to fix it:
- Remove the
includes of services you no longer use. - Write your server's IP address with
ip4:instead ofaandmx. - Move newsletter and marketing mail to a subdomain like
news.example.com, which gets its own SPF record.
Our lookup tool expands the include chain step by step and counts the total number of lookups.
Common mistakes
- More than one SPF record. A domain may have only one
v=spf1record. If there are two, both are treated as invalid; merge the services into one record. Adding the record a new service suggests as a separate record is the most common cause of this mistake. - Mechanisms after
all. Nothing afterallis evaluated. - Using the old "SPF" record type. The separate SPF record type (type 99) was retired in 2014. Add the record as TXT.
- Going over 255 characters. A single TXT string can be at most 255 characters. Panels usually split longer records automatically; if yours doesn't, shorten the record.
- Forgetting subdomains. SPF isn't inherited by subdomains. If you send mail from
info.example.com, that name needs its own SPF record.
