SPF: fix too many DNS lookups

The message “SPF PermError: too many DNS lookups” often appears out of the blue – usually after a new service such as a newsletter tool or a ticket system was added to the SPF record. The cause is almost always the same: your SPF record triggers too many DNS lookups. Here is how to count the lookups correctly and solve the problem for good.

Why there is a limit of ten DNS lookups

For every incoming email, the receiving server looks up your SPF record. To keep this check from triggering an unlimited number of further lookups and slowing servers down, the SPF standard RFC 7208 sets an upper limit: at most ten mechanisms may trigger a DNS lookup. If the limit is exceeded, the receiver aborts with “PermError” – as if you had no valid SPF record at all.

You often notice the consequences only later: emails land in spam, DMARC fails unless a DKIM signature saves the message, and your DMARC reports suddenly show many failures.

What counts as a DNS lookup – and what does not

  • Count: include:, a, mx, ptr, exists: and redirect=.
  • Count as well: all lookups inside included records. A single include: of a large provider may contain further references and use up several lookups at once.
  • Do not count: ip4:, ip6: and all – they are evaluated directly.
  • Additional limit: at most two lookups may come back empty (“void lookups”), for example because an included name no longer exists.

Counting by hand is tedious. The free DNS magnifier shows for every SPF record right away how many of the ten allowed lookups it uses.

Good to know: there may only be one SPF record per domain. Two TXT records starting with v=spf1 also lead to a PermError – regardless of the number of DNS lookups.

How to fix too many DNS lookups

1. Remove old services. Check every include:: do you still use the service? Former newsletter tools, web shops or phone systems often stay in the record for years. Your DMARC reports show which services actually send in your name.

2. Replace a and mx. If your own server sends from a fixed IP address, enter it directly with ip4: or ip6:. That saves lookups.

3. Drop ptr. The mechanism is considered outdated, is slow and is ignored by many receivers anyway.

4. Move services to subdomains. Send newsletters via news.your-domain.com, for example. The subdomain gets its own SPF record with its own ten lookups – and your main record is relieved.

5. Remove duplicate references. If the same provider appears twice in the record, it counts twice.

SPF flattening: manual or automatic?

If cleaning up is not enough, SPF flattening helps: instead of referring to the providers’ records, their IP addresses are entered directly. This no longer uses lookups – but there is a catch: if a provider such as Microsoft changes its servers, your record is outdated and emails suddenly fail. Manual flattening therefore needs constant checking.

With hosted SPF from Mailsecurity24 we take care of exactly that: you only enter one short reference, we combine all services, compare the addresses every hour and stay permanently below the limit. In case of disruptions the last working state always remains in place.

Check the result

After every change a quick look is worth it: the DNS magnifier shows the new number of lookups and whether the changed record has already arrived at Google and Cloudflare. With the domain check below you also check DMARC, DKIM and the other records of your domain. You will find more basics in the guide Check and set up your SPF record.

Free check · no sign-up

Domain protected? Email genuine? Check both.

Check in seconds whether your domain is protected against email spoofing – or whether an email really comes from the stated sender.

  • No sign-up
  • Result in seconds
  • Your data is never passed on

Frequently asked questions about too many DNS lookups

At most ten – including all lookups in included records. In addition, at most two lookups may come back empty.

No. IP addresses are evaluated directly and do not use a lookup. That is why it helps to enter fixed servers with ip4 or ip6.

The receiver aborts the check with PermError. SPF then counts as failed; without a valid DKIM signature DMARC fails as well, and emails land in spam or are rejected.

Yes, as long as the entered addresses are kept up to date. Manually entered addresses become outdated as soon as a provider changes its servers. An automatically maintained, hosted SPF avoids that.

Ready for secure email?

Try Mailsecurity24 free for 14 days. No payment details required.