Once you start using more than one email provider, SPF very quickly stops being a “set it once and forget it” record. Marketing platform, CRM, support desk, billing system, your own SMTP on a VPS… each one wants you to add another include:. Before long, an SPF evaluation can exceed the 10 DNS lookup limit and return permerror. That means SPF cannot authenticate that message; it does not mean the SPF record is absent.
In this article we’ll look at SPF for domains with multiple providers and long‑lived DNS setups. We’ll break down exactly what counts as an SPF lookup, how to count them, and what to do when you’re already over the limit. Then we’ll walk through the uses and limitations of IP consolidation, subdomains, redirect=, and SPF flattening for mail sent through shared hosting, VPS and dedicated servers.
If you already understand the basics of SPF, DKIM and DMARC, this is the next step: keeping SPF valid and maintainable when your email ecosystem gets complex.
Why SPF Hits a Wall with the 10 DNS Lookup Limit
SPF authorizes sending IP addresses for a domain used in the SMTP envelope MAIL FROM or HELO identity, not the visible From: header. The receiver evaluates the policy’s mechanisms in order; it does not first build a complete list of allowed IPs. To constrain DNS work, the RFC limits evaluation to 10 DNS‑causing terms across the policy and any nested evaluation. This is not simply a count of DNS packets sent.
When you’re using multiple external providers, each include: you add typically hides several more include:s inside it. Two or three vendors can be enough to break SPF, even if the record still “looks” short. Once evaluation would exceed 10 DNS‑causing terms, the SPF result becomes permerror (permanent error). This cannot provide an SPF pass for DMARC, but a successful aligned DKIM signature can still make DMARC pass. Delivery decisions also depend on the receiver’s local policy and other checks.
So advanced SPF management is mostly about one thing: delivering the intent of your policy while staying under that 10‑lookup ceiling.
Quick Refresher: How SPF and DNS Lookups Actually Work
If you need a step‑by‑step primer on SPF, DKIM and DMARC, we’ve written a dedicated guide: SPF, DKIM and DMARC explained for cPanel and VPS email. Here we’ll focus on the pieces that matter for the lookup limit.
Mechanisms and the Modifier that Count Toward the 10 Lookup Limit
These SPF mechanisms and the redirect modifier count toward the limit when evaluated:
include:example.com– fetches the SPF record of another domain.aora:example.com– resolves A/AAAA records.mxormx:example.com– resolves MX, then A/AAAA for those hosts.ptr– reverse DNS lookups (and it’s discouraged in modern SPF).exists:example.com– resolves that host.redirect=otherdomain.com– counts as one term when followed; terms evaluated in the target policy share the same limit.
These mechanisms do not trigger DNS lookups:
ip4:203.0.113.0/24ip6:2001:db8::/32all,+all,~all,-all
How to Manually Count SPF Lookups
The limit applies to terms reached along an evaluation path, including nested policies, not every term in a fully expanded tree. Trace the paths for your sending IPs and a nonmatching IP to estimate worst‑case usage:
- Start with your top‑level SPF record, e.g.
v=spf1 include:mailvendor.com include:crm.example.net ~all. - For each
include:, fetch that domain’s SPF and repeat the process. - Along each path, count every reached
include:,a,mx,ptrandexists, plusredirect=when followed, as one term. Recurse into included or redirected policies using the same counter; stop evaluating a policy when a mechanism matches. - Ignore
ip4,ip6andall– they don’t add lookups. - Ten counted terms are allowed. If the path requires an eleventh, the result is
permerror; the receiver does not simply ignore the remaining terms.
This can be tedious to do by hand, but it’s worth doing at least once for your domain so you get a feel for how “expensive” your current providers are in SPF terms.
Typical Multi‑Provider SPF Problems
Consider a hypothetical company with several independent email senders.
Example: Marketing, CRM, Helpdesk and In‑House SMTP
Imagine a mid‑size company using:
- A hosted email suite for day‑to‑day mailbox use.
- An email marketing platform for newsletters.
- A CRM that sends automated follow‑ups.
- A support/helpdesk platform for ticket emails.
- An on‑prem or VPS‑based SMTP service for application alerts and transactional mail.
Their SPF might look like this. The include targets below are placeholders, not vendor settings to publish:
example.com. IN TXT "v=spf1 include:mail-suite.example.net include:marketing.example.net include:crm.example.net include:helpdesk.example.net include:vps-smtp.example.net ~all"Each include could pull in further includes and other DNS‑causing terms. Five top‑level includes alone are within the limit, but a path requiring more than 10 terms across nested policies returns permerror. A path that matches earlier may still pass. For a message with SPF permerror, DMARC can pass only through successful aligned DKIM.
Symptoms You’ll See in the Real World
When a receiving server’s SPF evaluation exceeds the limit, your outbound logs may not show the authentication result, especially if the receiver accepts the message. Possible signs include:
- Deliverability for some providers suddenly drops while others look fine.
- DMARC aggregate reports show a lot of
spf=permerroreven for legitimate traffic. - Messages from certain systems (often the “last” ones you added) land in spam more often.
- Some online testers warn about “too many DNS lookups” or “SPF too complex”.
If you’re working through a broader deliverability checklist, our article Inbox or spam? A friendly, step‑by‑step guide to SPF, DKIM, DMARC and rDNS shows how SPF fits into the bigger picture.
Strategic Fixes Before You Touch DNS
Before diving into technical SPF tricks, it’s worth asking some architectural questions. Often the cleanest SPF setup starts with email strategy, not syntax.
Consolidate Providers Where It Makes Sense
A new provider can add SPF complexity, DNS records, and operational overhead. If your stack has grown organically over the years (one tool added per team), consider:
- Do you still need every platform that’s allowed to send from your main domain?
- Could some campaigns move to an existing provider instead of a new one?
- Are there legacy systems that no longer send but are still present in SPF?
Pruning unused or low‑value senders is often enough to bring SPF back under the limit without any advanced techniques.
Separate Sending Domains for Different Use Cases
One of the most powerful levers you have is the domain itself. Instead of using example.com as the envelope MAIL FROM domain for every system, configure separate sending identities on dedicated subdomains where providers support them. Changing only the visible From: address does not change which SPF policy is evaluated. For example:
news.example.comfor newsletters.crm.example.comfor CRM automation.support.example.comfor helpdesk replies.billing.example.comfor invoices and receipts.
Each envelope sending domain needs its own SPF policy. The 10‑term budget applies per SPF evaluation, including any nested includes or redirects; it does not reset when evaluation enters another domain. Independent subdomain policies can separate the senders that need authorization. For DMARC, each stream still needs successful SPF or DKIM aligned with its visible From: domain; only changing that visible address changes what users see.
We’ve explored this pattern in detail in our article using separate sending domains for transactional vs marketing emails. If you’re struggling with both deliverability and SPF complexity, this is often the best long‑term fix.
Align SPF Strategy with DMARC Policy
DMARC ties SPF (and DKIM) to the visible From: domain. When DMARC policy and SPF architecture are designed together, you can:
- Keep the main domain’s SPF focused on systems that use it as their envelope MAIL FROM domain.
- For separate sending identities, configure the envelope domain and visible From: domain deliberately: relaxed DMARC alignment compares organizational domains, while strict alignment requires an exact match. A subdomain SPF record alone does not establish alignment.
- Use DMARC aggregate (RUA) reports to see which services actually send.
That last point is important: DMARC reports reveal forgotten systems that still send email. Cleaning those up reduces both SPF complexity and surprise reputation issues later.
Technical Tactics to Stay Under 10 Lookups
Once you’ve decided which systems should legitimately send for each domain or subdomain, it’s time to design SPF syntax that stays within the limit.
1. Prefer ip4/ip6 Over include Where Possible
Many providers’ SPF documentation tells you to just add their include: and be done. That’s convenient for them, but not always optimal for you. If a provider documents a complete, stable set of outbound IP ranges and you can maintain updates, replacing its include: with explicit addresses may be practical:
v=spf1 include:spf.vendor.com ~allmight become the following illustrative record. The vendor name above is a placeholder, not a verified policy; the documentation addresses below must be replaced with authorized outbound ranges before use:
v=spf1 ip4:203.0.113.0/24 ip4:198.51.100.10 ip6:2001:db8:1234::/48 ~allAdvantages:
- No DNS lookups for those entries.
- Full control over exactly which IPs are allowed.
Trade‑offs:
- You must monitor the provider’s IP range changes (status pages, documentation, mailing lists).
- More manual work if they change infrastructure frequently.
This approach works best for systems you control (e.g. your own VPS or dedicated server) and for providers with clearly documented, rarely changing ranges.
2. Use redirect= to Split Responsibilities Cleanly
A record containing only v=spf1 and redirect= delegates evaluation to the target domain’s SPF policy, as in this example:
example.com. IN TXT "v=spf1 redirect=_spf.example.com"
_spf.example.com. IN TXT "v=spf1 ip4:203.0.113.0/24 ip4:198.51.100.10 ~all"Key points:
- An evaluated
redirect=counts toward the same 10-term DNS lookup limit asinclude:; DNS-causing terms evaluated in the target policy also count. It does not reset the budget. - In this example, the referring record contains no mechanisms; the target holds the authorized IP ranges and the final
~allpolicy. - This pattern is great for centralizing complex logic under a helper domain (e.g.
_spf.example.com) while leavingexample.comwith a short, simple record.
Centralization simplifies maintenance, not evaluation: the helper policy must still fit within the shared lookup budget.
3. Move Edge Use‑Cases to Subdomains
If your main domain is already near the limit, offload non‑critical or noisy senders to subdomains with their own SPF records. For instance, configure a monitoring system’s envelope MAIL FROM as alerts@infra.example.com instead of alerts@example.com, then publish SPF at that subdomain. Changing only the visible From: address is not enough. The following record uses an illustrative IP address that must be replaced with the actual outbound IP:
infra.example.com. IN TXT "v=spf1 ip4:198.51.100.20 ~all"Advantages:
- Keeps the primary domain’s SPF focused on its own senders.
- Gives mail evaluated against the subdomain’s SPF a separate 10-term budget. Including that policy from the parent does not create extra capacity within the parent’s evaluation.
- Helps distinguish operational email from customer‑facing traffic in DMARC reports when the sending identities are distinct.
This approach pairs nicely with a robust hosting setup – for example, running monitoring and automation tools on a VPS with their own sending identity – instead of trying to squeeze everything into one busy SPF record.
4. Remove Deprecated or Redundant Mechanisms
As SPF evolved, some mechanisms fell out of favor, especially ptr. If your record still contains ptr or overly broad a/mx mechanisms, you may be wasting lookups:
- Remove
mxif inbound servers do not send outbound mail; authorize the actual outbound systems instead. - Replace any legitimate authorization supplied by
ptrbefore removing it. - Review the addresses and CIDR ranges authorized by
amechanisms, and narrow or remove unintended authorization.
Each removed lookup is room you can spend where it matters more.
SPF Flattening: When and How to Use It Safely
Sometimes you really do need several providers, and their SPF policies are “heavy”: lots of nested includes, geo‑sharded IPs, and so on. That’s when SPF flattening becomes useful.
SPF flattening replaces suitable lookup‑based authorization with precomputed ip4/ip6 ranges, optionally retaining some necessary includes. It is not simply collecting every address found in DNS: the replacement must preserve which senders the original policy authorizes. Policies whose authorization depends on request-specific data may not have an equivalent static IP list.
We’ve published a dedicated, very hands‑on guide to automated flattening: how to beat the 10 lookup wall with automated SPF flattening. Below is the conceptual version for planning.
Manual Flattening for Small, Stable Setups
For a simple stack with documented, stable outbound ranges, manual flattening can work if you monitor upstream changes and update the record when needed:
- Take your current SPF and list all
include:,mx,aand other lookup‑based mechanisms. - Use
digornslookupto inspect DNS, and an SPF-aware tool to evaluate nested policies. Do not treat every returned address as authorized; preserve the original policy’s outcomes and leave unsupported or request-dependent mechanisms unflattened. - Compose a new SPF record using only
ip4andip6(and maybe a small number of truly necessary includes), for example, using documentation addresses that must be replaced with your authorized outbound ranges:
v=spf1 ip4:203.0.113.0/24 ip4:198.51.100.10 ip6:2001:db8:1234::/48 ~all - Validate syntax, DNS size and lookup limits, and compare expected results for authorized and unauthorized senders before publishing. Replace the existing SPF TXT policy rather than adding a second one, then test delivery and monitor results.
Manual flattening is practical only while the replacement remains equivalent to the intended policy. Stale data can omit new legitimate senders or continue authorizing retired IPs. For infrastructure you control, such as a fixed outbound gateway, tie SPF updates to server and IP allocation changes.
Automated Flattening with CI/CD and DNS APIs
For more dynamic or larger setups, automation is your friend. The pattern we like looks like this:
- Keep a “source of truth” SPF template in version control (e.g. Git) that still uses includes, with placeholder provider domains in this illustration:
v=spf1 include:spf.marketing-platform.com include:spf.crmvendor.com ~all. - Have a scheduled job (CI pipeline, cron job on a management VPS, etc.) that:
- Evaluates the supported parts of the template with an SPF-aware tool and derives the authorized ranges.
- Builds a candidate record, preserving any mechanisms that cannot safely be flattened.
- Validates syntax, DNS size, lookup limits and expected authorization results; on resolution or validation failure, retains the last known good record and alerts an operator.
- Replaces the existing SPF TXT policy via the DNS API only after validation, using credentials scoped to the required DNS changes.
- Stores the generated SPF and its inputs for auditing and rollback, and verifies the published result.
This can reduce lookup use and track upstream IP changes, provided resolution, validation and DNS publication succeed. Monitor job failures and stale output rather than assuming the automation guarantees a current policy. If you’re already using automation tools for your infrastructure – for example, provisioning VPSs with Ansible or Terraform as in our guide automating VPS setup with Terraform and Ansible – adding SPF flattening into that flow is a natural step.
How Often Should a Flattened SPF Be Refreshed?
Choose a refresh process based on upstream change practices and the consequences of stale authorization, not a universal daily or weekly interval:
- External providers: follow documented change notices and DNS TTLs when planning refreshes. A fixed daily or weekly job can still miss a change before new IPs begin sending.
- Providers without a dependable update process: retain their supported includes where possible, or use a separate envelope sending domain rather than relying on a stale snapshot.
- Your own infrastructure (VPS/dedicated servers with static IPs): authorize new outbound IPs before sending from them and remove retired IPs when they no longer send.
Automated flattening makes this schedule easy to maintain. You can even let different parts of the SPF come from different sources (some static IP ranges, some dynamic from flattening) as long as the published record preserves the intended authorization, stays current, fits DNS size limits and remains within the 10‑lookup budget.
Testing, Monitoring and Ongoing Maintenance
SPF is not a “set and forget” record once you’re using multiple providers. A few lightweight habits keep it healthy:
1. Always Test New SPF Changes
Before and after changing SPF:
- Use command‑line tools (
dig,nslookup) to inspect the TXT policy at authoritative servers and selected recursive resolvers. Sampled answers do not prove every cache has refreshed. - Send test emails from each legitimate sending path to major mailbox providers (Gmail, Outlook.com, etc.) and inspect receiver-added authentication headers for SPF pass on the intended MAIL FROM domain and for DMARC alignment.
- Use a reputable SPF syntax/lookup checker to confirm you’re under the 10‑lookup limit and there are no hidden includes.
If you run your own inbound mail server on a VPS or dedicated server with SPF checking and logging enabled, its logs can show SPF results for messages it receives. To check your outbound SPF, inspect results at the receiving server.
2. Watch DMARC Reports for permerror and Fails
DMARC aggregate (RUA) reports are an excellent early‑warning system. If you already have DMARC set up to send reports, look for:
- Rows whose raw SPF authentication results show
spf=permerrorfor legitimate IPs. - New senders that appear from IPs or providers you didn’t expect.
- Differences between SPF and DKIM alignment (sometimes you can rely on DKIM and simplify SPF).
For a deeper dive into DMARC analysis and BIMI, see our article beyond p=none: advanced DMARC, RUA/RUF analysis and BIMI.
3. Consider Forwarding and SRS/ARC Impacts
SPF checks the connecting IP against the envelope sender’s policy, so traditional email forwarding often breaks SPF. DMARC can still pass if an aligned DKIM signature survives forwarding. If you rely heavily on forwarding rules, you’ll want to:
- Use forwarders that implement SRS (Sender Rewriting Scheme) to rewrite the envelope sender so SPF can pass for the forwarder’s domain. This does not by itself restore SPF alignment with the original visible From domain.
- Leverage ARC (Authenticated Received Chain) where supported to carry authentication results through forwarding chains. Receivers must decide whether to trust those assessments; ARC does not automatically override DMARC failure.
We’ve covered this in detail in why forwarding breaks SPF/DMARC and how SRS and ARC help. While forwarding is not directly part of the 10‑lookup limit problem, it strongly influences how your SPF strategy behaves in the wild.
4. Re‑Audit Your SPF Once or Twice a Year
Businesses change marketing platforms, CRM tools and support systems all the time. Put a recurring reminder on your calendar to:
- List all systems that actually send email for each domain.
- Compare with what your SPF and DMARC reports say.
- Remove any systems you no longer use.
- Recalculate lookup counts and adjust includes or flattening schedules as needed.
This is also a great moment to align with broader hosting and infrastructure reviews – for example, when you’re planning upgrades to your VPS or consolidating services across data centers.
Planning Hosting and DNS for a Clean, Scalable SPF Strategy
Good SPF design lives at the intersection of DNS, email providers and the servers that actually send your mail.
Consider these design options when planning around the 10‑lookup limit:
- DNS and domain planning: Designing a domain/subdomain layout that separates marketing, transactional and support mail, with clear SPF and DMARC policies for each.
- Hosting mail gateways on VPS/dedicated servers: For a central SMTP relay or self‑hosted mail stack, size servers for the expected volume and identify their outbound IPs. Stable outbound addresses can keep SPF simple (often just a few
ip4/ip6entries). - SPF flattening automation: Integrating SPF generation into your existing CI/CD or management scripts, using DNS APIs and the same automation mindset you might already apply to your web stack.
- End‑to‑end deliverability tuning: Aligning SPF work with DKIM, DMARC, rDNS and IP reputation. Our guides such as dedicated IP warmup and email reputation management fit naturally into this process.
If you’re planning a new email architecture, migrating providers, or simply suspect your SPF is “too complicated”, it’s a good time to step back and design it properly. With the right domain strategy, a sensible choice of providers, and a bit of automation where it pays off, the 10 DNS lookup limit stops being a hard wall and becomes just another design constraint you know how to work with.
Before choosing hosting for a self‑hosted mail stack, verify the plan’s outbound SMTP policy, availability of stable sending IPs, and ability to configure matching forward and reverse DNS.





