- SPF allows 10 DNS lookups. Over 10, SPF fails with a permanent error for every message.
- Count your lookups first, including the ones hidden inside each
include:. - Remove services you no longer use, and includes for services that send from their own bounce domain.
- Replace stable includes with IP addresses, or move busy senders to a subdomain with its own 10 lookups.
What the limit is
When a receiving server checks SPF, it may make at most 10 DNS lookups while working through your record. The limit protects receivers from records that would send them chasing hundreds of DNS queries.
| Part of the record | Counts toward the 10? |
|---|---|
include: | Yes, one each, plus every lookup inside the record it points to. |
a, mx, exists, redirect= | Yes, one each. |
ptr | Yes. It's also slow and discouraged, so remove it. |
ip4:, ip6:, all | No. |
Nested includes are what catch most domains out. A single include: for a marketing platform can use three or four lookups on its own, so having fewer than 10 includes doesn't mean you're under the limit.
Void lookups count too. A lookup that returns no records, for example an include: for a service that has shut down, is a void lookup. More than two in one check also cause a permanent error.
How you know you're over
Going over the limit doesn't produce a bounce on its own. SPF simply stops working, and you notice the effects:
- Message headers show
spf=permerrorin theAuthentication-Resultsline. - Your DMARC reports show SPF failing for senders that are in your record.
- Mail that has no DKIM signature for your domain starts failing DMARC, and once you enforce DMARC, it's quarantined or rejected.
Receivers read your record from left to right and stop as soon as they find a match. A server near the start of the record may still pass while one near the end fails, which makes the problem look random.
Step 1: Count your lookups
Run your domain through our free SPF Record Checker. It follows every include, shows how many lookups each one uses, and highlights void lookups and errors. Write down each service in your record and its lookup count.
For a domain that only sends through Microsoft 365, the record is simple and well inside the limit:
v=spf1 include:spf.protection.outlook.com -all The problems start as other services are added over the years.
Step 2: Remove what you don't need
Go through each entry and ask whether it still sends email as this domain today.
- Services you've stopped using. Old newsletter tools, a previous help desk or a retired CRM often stay in the record for years.
- Duplicates. The same service included twice, or included both directly and inside another include.
aandmx. These authorize your website server and your inbound mail servers. If neither sends email as this domain, remove them. If your MX record points to Microsoft 365, its outgoing mail is already covered by the Microsoft include, somxadds nothing.ptr. Remove it.
Your DMARC reports are the best evidence here. A service that hasn't appeared in your reports for months probably doesn't send as your domain any more.
Step 3: Drop includes that don't help DMARC
This is the step most people miss. SPF checks the envelope sender, the hidden Return-Path address, not the From address people see. Many services send from their own bounce domain, such as bounces.newsletter-tool.example. For their messages, receivers check their SPF record, not yours, so your include: for them is never used.
To find out, open a message the service sent and look at the Authentication-Results header:
spf=pass smtp.mailfrom=bounces.newsletter-tool.example
dkim=pass header.d=yourcompany.com
dmarc=pass header.from=yourcompany.com Here SPF passed for the service's own domain, and DMARC passed because DKIM signed with yours. Your include for this service does nothing, so you can remove it. Do confirm with the service's documentation first, and make sure DKIM for your domain is set up in it.
DKIM is the better fix. Unlike SPF, DKIM has no lookup limit and survives forwarding. For every service that supports custom DKIM, set it up with your domain. See why third-party email fails DMARC.
Step 4: Use IP addresses for stable senders
If a service publishes a small, stable list of sending IP addresses, you can replace its include: with ip4: or ip6: entries, which don't count toward the limit:
v=spf1 include:spf.protection.outlook.com ip4:203.0.113.0/28 -all The trade-off is upkeep. If the service changes its addresses, your record silently stops matching. Only do this for services that document their ranges, and check them at least every quarter.
Never replace the Microsoft 365 include with IP addresses. Microsoft's sending addresses change frequently. Always keep include:spf.protection.outlook.com.
Step 5: Move senders to subdomains
Every domain and subdomain has its own SPF record and its own 10 lookups. Moving a marketing platform to news.yourcompany.com or a help desk to support.yourcompany.com takes its lookups out of your main record.
- Set up the subdomain as the sending domain in the service, following its instructions.
- Publish SPF and DKIM for the subdomain as the service tells you.
- Remove the service's include from your main domain's record once it sends only from the subdomain.
Your DMARC policy covers subdomains automatically unless you set sp= or publish a separate record for the subdomain. Microsoft also recommends subdomains for services you don't control, because a problem with their reputation then can't affect your main domain.
What about SPF flattening?
Flattening replaces includes with the IP addresses they resolve to, so the record uses fewer lookups. Doing it by hand is the same as step 4, with the same upkeep risk across every service. Some services offer automated flattening or hosted SPF, which update the addresses for you; if you use one, make sure you understand what happens if it stops updating. Whatever you choose, keep the Microsoft 365 include as it is.
Common mistakes
- Adding a second SPF record instead of merging. Two
v=spf1records cause a permanent error on their own. - Counting includes instead of lookups. Nested lookups are what push most records over.
- Leaving includes for services that have shut down. These become void lookups.
- Flattening Microsoft 365. It will break when Microsoft's addresses change.
- Fixing SPF and forgetting DKIM. With DKIM aligned for every service, an SPF problem no longer fails DMARC.
- RFC 7208: Sender Policy Framework (SPF), section 4.6.4 DNS lookup limits
- Microsoft Learn: Set up SPF to identify valid email sources for your Microsoft 365 domain
- Microsoft Learn: Anti-spam message headers in Microsoft 365
Microsoft updates its admin portals regularly. If a menu name differs from this guide, the Microsoft documentation above has the current path.