What is an SPF record?
SPF (Sender Policy Framework) is a TXT record in your domain's DNS that starts with v=spf1. It lists who may send email using your domain in the envelope sender (the Return-Path), and ends with a rule for everyone else.
v=spf1 include:spf.protection.outlook.com include:sendgrid.net -all
- include: trusts another domain's SPF record, usually your email provider or a sending service.
- ip4 / ip6: trusts a specific address or range.
- a / mx: trusts the servers in your domain's A or MX records.
- all: the rule for everyone not listed.
-all means fail, ~all means soft fail.
The 10 DNS lookup limit
To check SPF, the receiving server may make at most 10 DNS lookups. Every include, a, mx, ptr, exists and redirect counts, including the ones inside included records. ip4, ip6 and all don't count.
Go over 10 and the result is a permanent error, which most receivers treat as an SPF failure. It's one of the most common reasons legitimate mail fails DMARC. To get back under the limit:
- Remove services you no longer use.
- Replace
a and mx with ip4 addresses if your servers rarely change. - Send marketing and bulk email from a subdomain, such as
news.yourcompany.com, with its own SPF record. - Rely on DKIM for services that support it. DMARC only needs SPF or DKIM to pass.
SPF for Microsoft 365
If your mail is hosted in Microsoft 365 and nothing else sends for your domain, this is the whole record:
v=spf1 include:spf.protection.outlook.com -all
- Add one
include for each other service that sends as your domain, such as a newsletter tool or CRM. Their setup guides give the exact value. - A domain can have only one SPF record. Add new services to the existing record instead of creating a second one.
- SPF alone isn't enough. Turn on DKIM in Microsoft 365 and publish a DMARC record.