Skip to content
RESEARCH INDEX BREACHROAD / INTELLIGENCE NOTE

SPF PermError: Too Many DNS Lookups — How to Fix It

SPF breaks above 10 DNS lookups. The RFC 7208 limit explained, how to count lookups across includes and how to shorten the record without hurting delivery.

PUBLIC RESEARCH
AUTHOR
/ Founder of Breachroad
PUBLISHED
27 November 2026
READING TIME
11 min read
TOPIC
Cloud, Infrastructure and DevSecOps
SPF PermError: Too Many DNS Lookups — How to Fix It
FREE TOOL · LIVE DNS Can someone spoof your domain? Test SPF, DKIM and DMARC Enter your domain — we count SPF lookups, check the DMARC policy and DKIM keys, and give you records to fix.

As a company grows, so does the list of services that send e-mail “on its behalf”: mail in Google Workspace or Microsoft 365, a newsletter, a CRM, an invoicing system, an online shop, a helpdesk. Every setup guide ends with the same sentence: “add include:… to your SPF record”. After a few of those steps the record looks solid — but in practice it has stopped working, because it went over the 10 DNS lookup limit and receiving servers return PermError.

It’s one of the most common e-mail configuration mistakes, and one of the sneakiest: you can’t see it in the DNS panel, and mail often keeps arriving, so nobody notices that spoofing protection has silently disappeared. This guide explains where the limit comes from, how to count lookups and how to shorten the record without losing legitimate mail.

Check your domain: the free SPF, DKIM and DMARC checker counts DNS lookups recursively — the way mail servers do — and shows the include tree with the number of lookups at each level.

What SPF PermError is

SPF (Sender Policy Framework) is a DNS TXT record listing the servers allowed to send mail as your domain. A receiving server evaluates it for every incoming message and returns a result: pass, fail, softfail, neutral, none or an error.

PermError (permanent error) means the record cannot be evaluated correctly. The most common causes:

  • the 10 DNS lookup limit is exceeded — the subject of this guide;
  • several v=spf1 records on one domain — exactly one is allowed;
  • more than two “void” lookups, for example an include pointing to a domain that no longer has an SPF record;
  • a syntax error, such as a typo in a mechanism name.

The effect is the same: SPF stops protecting the domain. In DMARC, PermError is not a “pass”, so DKIM alone decides whether a message gets through. If DKIM isn’t set up correctly and aligned with the sender’s domain either, legitimate mail can land in spam or be rejected, and spoofing becomes easier.

Where the 10-lookup limit comes from

The SPF standard, RFC 7208, says plainly in its section on DNS lookup limits: implementations must limit the number of DNS-querying terms to 10, and when the limit is exceeded they must return permerror. The limit protects mail servers from records whose evaluation would take hundreds of queries — and from SPF being abused to attack DNS.

These count towards the limit:

TermCounts towards the 10-lookup limit?
include:yes — plus everything in the record it includes
a, mxyes
ptryes (and discouraged by RFC 7208)
exists:yes
redirect=yes
ip4:, ip6:no
allno

The key word is recursively. include:_spf.provider.com is one lookup, but if the provider’s record contains three more includes, your domain has already used four. Large platforms can consume half the limit on their own.

RFC 7208 also introduces a second, lesser-known limit: at most two “void” lookups — queries that return no record. The classic case is an include for a service the company stopped using long ago.

How to count the lookups in your SPF — an example

Take the record of a company using Microsoft 365, a newsletter and an invoicing system:

v=spf1 mx a include:spf.protection.outlook.com include:newsletter.example include:invoices.example -all

We count:

  1. mx — 1
  2. a — 1
  3. include:spf.protection.outlook.com — 1 + the lookups inside Microsoft’s record
  4. include:newsletter.example — 1 + its includes
  5. include:invoices.example — 1 + its includes

If the newsletter’s record has three more includes and the invoicing system two, we’re already at 10–11 lookups — with only three services. Counting by hand is tedious and error-prone, because providers change their records without warning. That’s why it’s worth using a tool: the SPF checker shows the whole tree and the exact count.

How to fix SPF PermError — 6 ways

Start with the simplest and safest. Leave flattening for last.

1. Remove unused includes

Go through the list and ask for each entry: does this service still send mail from our domain? An old CRM, a finished campaign, a test newsletter — typical clutter in SPF. Each removed include can free up several lookups. Be sure to remove those pointing to domains without SPF — they cause “void” lookups.

2. Remove unnecessary a and mx

The a and mx mechanisms authorise the servers in your domain’s A and MX records. If your mail runs on Google Workspace or Microsoft 365 and your website doesn’t send mail directly, a and mx are often redundant — the mail provider’s include already covers authorisation.

3. Check whether the service really needs an include

This is the most overlooked point. SPF checks the domain in the bounce address (Return-Path, MAIL FROM), not the “From” field. Many mailing platforms send from their own bounce domain or let you set a bounce subdomain (e.g. bounce.yourcompany.com) via a CNAME record. SPF is then checked on that subdomain, and the include in your main record achieves nothing. The “From” field is protected by DKIM and DMARC. Look for “custom return path” or “custom bounce domain” in each service’s documentation.

4. Move sending to subdomains

Newsletters from news.yourcompany.com, invoices from invoices.yourcompany.com — each subdomain has its own SPF record with its own 10-lookup limit. It’s the cleanest solution when you have many providers. It also isolates reputation: problems with a marketing campaign don’t hurt the deliverability of your company mail.

5. Replace ptr with something else

The ptr mechanism is slow, unreliable, and RFC 7208 says it should not be published. If you have it, replace it with ip4/ip6 or the provider’s include.

6. Flatten the record (carefully)

Flattening replaces includes with specific ip4: and ip6: addresses that need no DNS lookups. It works, but has a serious drawback: providers change their server addresses without notice, and hard-coded addresses don’t update. After such a change, some legitimate mail starts failing — often without any visible alarm. Only flatten addresses you control (your own servers), or use an automated service that refreshes the list regularly.

Other errors that cause PermError

  • Two SPF records. A common result of adding a new record instead of editing the existing one. Merge them into one — the mechanisms from both, a single -all at the end.
  • Typos. inlude:, an ip4: with an invalid range, a space inside a mechanism.
  • Loops. Record A includes record B, which includes record A.

How to check that the fix worked

  1. Run the SPF, DKIM and DMARC checker again — the lookup count should drop to 10 or fewer and the warning should disappear.
  2. Send a message to a Gmail inbox and choose “Show original” in the message menu. Gmail shows the SPF, DKIM and DMARC results in a summary — SPF should say PASS.
  3. If your DMARC record has an rua= address, watch the aggregate reports for a few days — they’ll show whether any legitimate service started failing.

Remember that DNS changes propagate according to the record’s TTL — usually from a few minutes to a few hours.

SPF is only half the story

Even a perfect SPF record doesn’t protect the “From” field the recipient sees. For that you need DKIM and DMARC with a policy that blocks spoofed messages. If your DMARC has p=none, read how to move safely to p=reject, and if the checker can’t find your DKIM — how to find your DKIM selector. The basics of all three mechanisms are in SPF, DKIM and DMARC explained.

Sources: RFC 7208 — Sender Policy Framework (SPF), section 4.6.4 (DNS lookup limits) and 5.5 (the ptr mechanism). Recommendations are Breachroad’s analysis.

FAQ

Frequently asked questions

What does SPF PermError mean?
PermError (permanent error) is the result a receiving server returns when an SPF record cannot be evaluated correctly — most often because it exceeds the 10 DNS lookup limit, because several v=spf1 records exist at once, or because of a syntax error. SPF then stops protecting the domain and counts as a failure in DMARC.
How many DNS lookups can an SPF record have?
At most 10. RFC 7208 counts the include, a, mx, ptr and exists mechanisms and the redirect modifier — including those inside nested includes. The ip4, ip6 and all mechanisms need no lookups and do not count towards the limit.
How do I check how many DNS lookups my SPF uses?
Use a tool that counts lookups recursively, such as Breachroad's free SPF, DKIM and DMARC checker. It shows the include tree with the number of lookups at each level and points out which entries need shortening.
Is SPF flattening (replacing includes with IP addresses) safe?
It works, but it needs maintenance. Providers change server addresses without notice, and hard-coded ip4/ip6 entries don't update — when that happens, some legitimate mail starts failing. It is safer to remove unnecessary includes first and move third-party sending to subdomains.
Do I need an include for every service that sends e-mail?
Not always. SPF checks the domain in the bounce address (Return-Path), not the From field. Many mailing platforms use their own bounce domain or a subdomain you set up with a CNAME record — in that case their include in your main SPF record is unnecessary. The From field is protected by DKIM and DMARC.

SHARE / COPY