Auditing Third-Party SPF Includes Before They Break Your Mail
Your SPF record delegates trust to third parties; this playbook shows you how to audit those `include` mechanisms before they cause delivery failures.

Your marketing team just onboarded a new automation platform. They ping you on Slack: 'Need to add this to our SPF record so our emails don't go to spam.' The request includes a snippet: `include:sp.example.com`.
This happens every day in IT and security operations. It seems harmless. It is not. Every `include` in your Sender Policy Framework (SPF) record is an act of delegation. You are not just allowing IPs; you are trusting another organization's entire email security posture and their DNS hygiene. You're also borrowing their DNS lookups, and that debt can come due at the worst possible time.
Most SPF-related delivery failures don't come from a typo in your own record. They erupt from the opaque, nested complexity hidden behind a vendor's `include` statement. It's a silent risk that grows with every new service you bolt onto your domain.
The Dangerous Delegation of `include:`
An SPF record is a simple TXT entry in your DNS, but its function is profound. It tells receiving mail servers which IP addresses are authorized to send email on behalf of your domain. The `include:` mechanism is a pointer, essentially saying, 'Go check the SPF record for this other domain and trust whatever it says.'
This creates two immediate problems. First, you inherit the security posture of the included domain. If that vendor configures an overly permissive record or, worse, their DNS is compromised, attackers could potentially use their infrastructure to send mail that passes SPF checks for *your* domain. You've outsourced a piece of your reputation.
The Ten-Lookup Limit
The second, more common and operationally painful problem is the DNS lookup limit. As defined in RFC 7208, a receiving mail server must not perform more than 10 DNS lookups that require resolution (like `include`, `a`, `mx`, `exists`, and `redirect`) while evaluating an SPF record. Exceed this limit, and the check results in a `permerror`.
A `permerror` is often treated by receivers as a `fail`. This means your legitimate email—from your CEO, your billing system, your support desk—gets silently dropped or flagged as spam. The worst part is that your own record might only have five `include` statements. But if one of those includes another two, and one of *those* includes another three... you can see how this escalates. One `include` is not one lookup; it's one lookup *plus* the entire lookup chain behind it.
Manual Audit: Following the Trust Chain with `dig`
You cannot trust what you don't verify. Auditing your `include` chain is non-negotiable. The simplest way to start is with the same tool a mail server would use: a DNS query tool like `dig`.
Let's assume your SPF record contains `include:_spf.google.com`. Your first step is to resolve the TXT record for that domain to see what's inside. This is your first lookup.
$ dig TXT _spf.google.com +short
v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all
Interesting. Google's own SPF record doesn't contain any `ip4` or `ip6` mechanisms directly. Instead, it contains three more `include` statements. This single line in your SPF record is already responsible for 4 total lookups (1 for `_spf.google.com` and 1 for each of the `_netblocks` domains). We are still well under the limit of 10, but this illustrates how quickly the count multiplies.
Recursively Counting the Real Cost
To perform a full audit, you must do this for every mechanism in your record. Keep a running tally. `v=spf1 include:one.com include:two.com ~all`. Start by `dig`ging `one.com`. Add its lookups to your count. If `one.com` includes `three.com`, you must follow that chain, too. Repeat for `two.com`. Be methodical. Watch out for redirects (`redirect=`), which terminate processing for that record but direct the receiver to a new one, costing another lookup.
If you find a vendor's include chain consumes seven lookups all by itself, you have a problem. That leaves you with only three lookups for all your other services and your own `a` or `mx` records. That's a delivery incident waiting to happen.
Case Study: The Hidden Cost of `include:salesforce.com`
Let's examine a real-world example common in enterprise environments. Your sales team uses Salesforce to send email, so `include:salesforce.com` gets added to your primary domain's SPF record. What have you just done?
First, you fetch the SPF record for `salesforce.com`. It might look something like this: `v=spf1 include:_spf.salesforce.com mx ~all`. That's two lookups right away: one for the `include` and one for the `mx`.
Now we go deeper, resolving `_spf.salesforce.com`. You'll find it contains several more `include` statements, often segmented by service or region, like `include:spf.sfdc.net` and `include:spf.exacttarget.com`. Each of these are distinct SPF records that must be fetched and evaluated. The `spf.exacttarget.com` record, a remnant of acquisitions, is itself a forest of further includes for different components of their massive sending infrastructure.
A single line item for Salesforce can easily unpack into 6-8 DNS lookups before the trail ends. If your record already includes Office 365 (`include:spf.protection.outlook.com`, which itself is 2-3 lookups) and a marketing platform like Mailchimp, you have likely already breached the 10-lookup limit. You won't know until users report that their outbound emails are failing.
This isn't an attack on Salesforce; it's a structural reality of large-scale email platforms. Their infrastructure is complex, and their SPF records reflect that. The operational mistake is blindly including this complexity in your own apex domain's record without understanding the downstream cost.
Automating the Audit: Beyond the Command Line
A manual `dig` audit is essential for understanding the mechanics, but it's a terrible way to manage SPF long-term. It's time-consuming, error-prone, and provides only a point-in-time snapshot. The vendor you audited today could change their SPF record tomorrow, pushing your perfectly compliant record over the lookup limit.
This is where automated SPF validators come in. These tools essentially perform the recursive `dig` workflow you just did, but instantly and comprehensively. They crawl every `include`, `a`, `mx`, and `redirect` in your record, map the entire dependency tree, and present you with a final lookup count. They'll also flag syntax errors, deprecated mechanisms (`ptr`), and dangerous configurations like redirects to nowhere.
An automated check should be the first step before adding any new `include` and a recurring step in your security monitoring. A vendor adding one benign IP to their record is fine. A vendor refactoring their entire SPF structure and adding five new nested `include` mechanisms is an emergency for your mail flow. Automation is the only way to catch that before it impacts delivery.
Quarantine the Risk: The Subdomain Strategy
If you've audited your `include`s and discovered a bloated, lookup-heavy vendor that is essential to your business, you don't have to just accept the risk. The most effective mitigation strategy is isolation.
Do not allow third-party services, especially high-volume marketing or transactional platforms, to send using your main corporate domain (e.g., `yourcompany.com`). Instead, create dedicated subdomains for them. Let Salesforce send from `sales.yourcompany.com` and your marketing platform from `news.yourcompany.com`.
Creating an Isolated SPF Policy
Each subdomain has its own, independent SPF record. The SPF record for `sales.yourcompany.com` can contain the complex, multi-lookup `include:salesforce.com` without affecting your primary domain at all. The SPF record for `yourcompany.com` remains clean, simple, and reserved for your corporate mail servers, like Google Workspace or Microsoft 365.
This strategy has multiple benefits. It solves the 10-lookup limit problem decisively. It also compartmentalizes reputation. If a marketing email blast from `news.yourcompany.com` gets marked as spam, it damages the reputation of that specific subdomain, not your primary corporate domain used for critical business communication. It also enhances clarity for end-users, who can more easily distinguish a promotional email from a direct communication.
This requires coordination with the business units using these services, but the operational stability and risk reduction are well worth the effort. It's the difference between a resilient email architecture and one that's a single vendor change away from collapse.
The takeaway
An SPF record is not a 'set and forget' artifact. It's a living policy document that declares to the world who is authorized to speak for you. Every `include` is a liability you must actively manage, not a convenience you can blindly trust. The health of your email deliverability depends on it.
Start with the manual audit to build muscle memory. Then, bake automated validation into your change control process for any DNS updates. The tools at MailSleuth.AI can provide this continuous monitoring, turning unknown dependencies into a clear, actionable dashboard. Stop inheriting risk and start managing your domain's sending authority with intention.
We dissect phishing campaigns and email infrastructure so you don't have to.


