Skip to content
startupcybersecurity
Email securitySPF

SPF "Too Many DNS Lookups": How to Fix the 10-Lookup Limit

Why SPF fails with permerror after 10 DNS lookups, how to count yours, and five safe ways to get back under the limit without breaking email.

Jay Dabhi

By , CISM · Cybersecurity Analyst

Updated

2 min read

SPF fails with a "permerror" when evaluating your record takes more than 10 DNS lookups (RFC 7208, section 4.6.4). Every include, a, mx, ptr, exists and redirect counts, including the ones nested inside each provider you include. To fix it, remove senders you no longer use, move marketing email to a subdomain with its own SPF record, and replace a and mx mechanisms with ip4/ip6 ranges.

Why startups hit the limit

A typical record grows one tool at a time:

v=spf1 include:_spf.google.com include:sendgrid.net include:mail.zendesk.com
  include:_spf.salesforce.com include:servers.mcsv.net include:mktomail.com ~all

That's only six includes, but several providers include further records of their own. A record like this can easily need 10 or more lookups. Nothing warns you when you cross the line: SPF just stops working.

Step 1: count your lookups

Run your domain through our free SPF checker. It follows every include and shows how many lookups each one costs, so you can see which provider is responsible.

Step 2: remove what you don't use

The fastest fix is deleting includes for tools you've stopped using: the old marketing platform, a trial helpdesk, a CRM you migrated away from. Check with your team before removing anything still in use.

Step 3: send marketing email from a subdomain

Marketing and newsletter platforms are usually the heaviest includes. Send them from a subdomain such as news.yourdomain.com, which gets its own SPF record and its own 10-lookup budget:

yourdomain.com       TXT  "v=spf1 include:_spf.google.com include:sendgrid.net ~all"
news.yourdomain.com  TXT  "v=spf1 include:servers.mcsv.net ~all"

This also protects your main domain's reputation if a marketing campaign gets spam complaints.

Step 4: replace a and mx with IP ranges

a and mx each cost a lookup. If you know the IP addresses of your own mail servers, list them directly. ip4 and ip6 are free:

v=spf1 ip4:203.0.113.10 include:_spf.google.com ~all

Remove ptr entirely. It's deprecated and slow.

Step 5: rely on DKIM for tools that support it

Many email providers sign messages with DKIM using your domain. DMARC passes if either SPF or DKIM passes with alignment, so a provider that signs with DKIM doesn't strictly need to be in your SPF record. Check each provider's documentation before removing it, and watch your DMARC reports afterwards.

Avoid these quick fixes

  • Two SPF records. Splitting one long record into two doesn't add capacity. Two v=spf1 records are a permanent error.
  • Ending with +all. It "fixes" failures by authorizing every server on the internet.
  • Unmanaged flattening. Hard-coding a provider's IPs works until they change. Then legitimate email fails.

Check your work

After changing your record, run the SPF checker again and confirm you're at or under 10 lookups, ideally with room for the next tool you add.

Frequently asked questions

Does ip4: or ip6: count toward the 10-lookup limit?

No. ip4, ip6 and all don't need DNS queries, so they're free. Only include, a, mx, ptr, exists and redirect count, including the ones nested inside the providers you include.

Is SPF flattening safe?

It works, but it's fragile. Flattening replaces includes with the provider's current IP addresses. When the provider changes its IPs, your record goes stale and legitimate email starts failing. Only flatten with a service that updates the record automatically.

What happens when SPF hits a permerror?

Receivers treat SPF as failed. If DKIM still passes with alignment, DMARC can still pass, but any message that relies on SPF alone will fail DMARC and may be rejected or sent to spam.

More guides