What SPF does
SPF (Sender Policy Framework) is a TXT record that lists the servers allowed to send email for your domain. When a message arrives, the receiving server compares the sending server's IP address with your list. If it isn't there, the message fails SPF.
A typical record for a business using two services looks like this:
v=spf1 include:_spf.google.com include:send.example-provider.com ~allHow the record is built
| Part | Meaning |
|---|---|
v=spf1 | Marks the record as SPF. It must come first. |
ip4: / ip6: | Allows a single address or range. Costs no lookups. |
include: | Allows every server listed in another domain's SPF record. Costs one lookup plus everything inside it. |
a / mx | Allows the servers your domain's A or MX records point to. One lookup each. |
~all / -all | What happens to everyone else: softfail or fail. It goes last. |
Staying under 10 lookups
The lookup limit is where most SPF records break. Large providers include several more records inside their own, so one include: can cost three or four lookups. To get back under the limit:
- Remove services you no longer send from. Old newsletter tools and CRMs are the usual suspects.
- Replace
aandmxwith the actualip4:addresses if they rarely change. - Send marketing email from a subdomain such as
news.yourdomain.comwith its own SPF record.
Need to build a record from scratch? Use the SPF generator.
SPF is only one part
SPF breaks when mail is forwarded, because the forwarding server isn't on your list. That's why DKIM and DMARC exist: DKIM signatures survive forwarding, and DMARC passes if either one lines up with your domain. Check all three together with the email DNS checker.