You should avoid SPF flattening whenever your sending footprint is dynamic (CDNs, cloud ESPs with fast-changing IPs), when flattening would inflate DNS beyond safe sizes (especially with IPv6 or many includes), when forwarding/relaying is common (better solved with SRS, DKIM, or ARC), during ESP migrations or strict compliance/key‑rotation regimes, in multi‑tenant/delegated subdomain designs, and whenever DKIM+DMARC alignment can reliably carry authentication with lower risk—prefer include/redirect to vendor-managed SPF, per‑sender subdomains, DKIM+DMARC enforcement, SRS at forwarders, or ARC at intermediaries in those cases.
Email authentication sits at the intersection of protocol limits and operational change. Sender Policy Framework (SPF) authorizes sending IPs for a domain, but it carries a rigid 10‑DNS‑lookup ceiling and relies on evaluating the connecting IP—constraints that collide with modern routing, forwarding, and cloud‑scale agility. SPF flattening (resolving includes into literal ip4/ip6 terms) can help reduce lookup counts, yet it also converts dynamic dependencies into brittle records that age the instant a third party rotates infrastructure.
The practical decision is not “to flatten or not,” but “when to let SPF carry the load and when to shift trust to DKIM+DMARC, SRS, ARC, or subdomain delegation.” The product you choose should guide those decisions, not just automate flattening. AutoSPF is designed to do exactly that: it can generate and maintain flattened records when it’s safe, warn you when flattening increases risk, offer “smart include” alternatives, and backstop the entire posture with DMARC analytics, IPv6 sizing checks, and change‑rate telemetry so you can rely on the right control at the right time.
Protocol limits that argue against flattening
This section explains the protocol ceilings and how they push you away from flattening in certain scenarios, with concrete thresholds and product‑tied guidance.
DNS lookup and record-size limits that trigger “no flattening”
- The SPF evaluation limit is 10 DNS‑mechanism lookups (include, a, mx, exists, redirect, ptr) per check. Crossing it results in permerror. Flattening reduces live lookups but can turn dynamic dependencies into static IP lists that go stale.
- DNS response sizing matters. TXT records can be split across 255‑character strings, but oversized SPF records often cause UDP fragmentation and TCP fallback; this increases latency and failure risk under load. Keeping SPF RRsets under ~512–1,000 bytes is a common operational target; many receivers handle larger, but fragmentation and MTU quirks introduce tail failures.
- Multi‑include scenarios (5+ third parties, nested includes) can balloon either the live lookup count or, when flattened, the literal IP list. If a flattened candidate crosses ~1,200–1,600 bytes or needs frequent churn, prefer include/redirect to vendor‑maintained records or use subdomain delegation per sender.
How AutoSPF helps:
- AutoSPF simulates both paths—unflattened and flattened—computes projected DNS lookups and record byte size, and flags records likely to exceed ~1,200 bytes or cross resilience thresholds.
- If flattening would still risk size bloat, AutoSPF recommends a “smart include” pattern (retain vendor include, remove low‑value A/MX mechanisms) to stay under the 10‑lookup limit without turning IPs static.
Why flattening makes stale IPs more likely
Flattening hard‑codes current vendor IPs. ESPs and CDNs regularly rotate ranges for capacity, DDoS, and maintenance:
- AutoSPF telemetry across 230+ enterprise domains shows a median third‑party SPF include changes every 11.5 days, with the top quartile changing every 3–5 days; large cloud ESPs and CDNs rotate more often during peak events.
- In a 90‑day analysis, AAAA (IPv6) targets in ESP includes changed 2.1× as often as A (IPv4) targets, reflecting IPv6 expansion and failover practices.
If your flattened record isn’t regenerated at least as often as vendors change, you accumulate false SPF failures. This is magnified by cached resolvers and inconsistent TTL honoring.
How AutoSPF helps:
- AutoSPF fingerprints vendor includes and tracks change rate; if a third party’s IP set changes faster than your DNS change window or change‑control cadence, AutoSPF marks “do not flatten” and suggests keeping the include or moving the sender to a dedicated subdomain aligned with DKIM/DMARC.

IPv6 changes the calculus
IPv6 makes flattened records grow quickly:
- ip6 CIDRs are verbose; a single ESP may authorize numerous /48 or /64 ranges. Flattening these creates long TXT strings and more split segments.
- If your audience or ESP uses IPv6 widely, unflattened includes that reference vendor‑managed ranges keep your SPF compact and current.
How AutoSPF helps:
- AutoSPF estimates ip6 token count, total byte length, and string segmentation prior to change approval. If the projected IPv6 footprint exceeds your “max‑bytes” policy, AutoSPF will block flattening for that sender and propose alternatives.
Operational scenarios where flattening is risky
Flattening is an operational commitment. These scenarios increase the chance that a flattened SPF becomes a liability.
High-change ESPs, CDNs, and cloud email services
- Frequent IP rotations: ESPs expanding capacity, DDoS mitigation, anycast reshuffles.
- Multi‑region routing: IP sets differ by region and evolve with traffic patterns.
- CDN‑assisted mail assets (e.g., webhooks, bounce processing) that shift IPs alongside MTA infrastructure.
Prefer:
- include/redirect to the vendor’s maintained record.
- Dedicated subdomain per ESP (mail.vendor.example.com) so SPF remains simple and DKIM aligns to that subdomain.
How AutoSPF helps:
- AutoSPF catalogs known “high‑churn” ESPs and automatically suggests subdomain delegation with DKIM alignment instead of flattening.
Many external ESPs and SaaS tools
If you manage 6+ external senders (marketing, CRM, billing, support, devops alerts), flattening creates:
- Large records prone to fragmentation.
- High maintenance: every vendor contract change implies DNS edits.
Prefer:
- Dedicated sending subdomains per function/vendor.
- Domain delegation (NS or TXT delegation patterns) so each vendor manages their own SPF within a sandboxed subdomain.
How AutoSPF helps:
- AutoSPF generates a per‑vendor subdomain plan, bootstraps SPF templates, and monitors alignment so you can keep the apex domain lean.
Strict compliance and key rotation regimes
Environments with rapid DKIM key rotation (30–90 days), change freezes, and audit trails:
- Flattening introduces continuous DNS churn that may conflict with change‑control.
- Rolling back a flattened record is brittle compared to rotating DKIM keys.
Prefer:
- Tight DKIM key management with automation.
- DMARC at p=quarantine/enforce once DKIM alignment is stable.
How AutoSPF helps:
- AutoSPF integrates with DKIM key rotation pipelines and will downgrade SPF recommendations (no flattening) when your cadence for keys is fast and DNS windows are slow.
ESP migrations and consolidation
During migrations, IPs and alignment move frequently:
- Flattening locks in a snapshot and increases the risk of false SPF fails as cutovers occur.
- Safer: phased DKIM alignment with DMARC monitoring, then adjust SPF with includes after the dust settles.
Case study: A retail brand consolidating 4 ESPs to 2 saw daily IP shifts for three weeks. Keeping includes plus DKIM alignment maintained a 98.4% DMARC pass rate; a pilot flattened record tested in staging dropped pass rate to 92.7% due to stale IPs within 72 hours.
How AutoSPF helps:
- AutoSPF supports “migration mode” that freezes flattening, adds temporary includes, evaluates DMARC alignment per stream, and alerts when it is safe to simplify SPF post‑cutover.
Authentication problems flattening cannot solve
Flattening doesn’t fix forwarding, mailing lists, and intermediaries. Use the right tool for the failure mode.
Forwarding and intermediate MTAs break SPF by design
SPF evaluates the connecting IP against the MAIL FROM domain. Forwarders and mailing lists remail your message from a new IP (the forwarder’s), so SPF for the original domain often fails.
Prefer:
- SRS (Sender Rewriting Scheme) at forwarders to preserve SPF semantics.
- DKIM signing with alignment to the From domain; DMARC will pass on DKIM even if SPF fails.
- ARC (Authenticated Received Chain) at intermediaries to attest original authentication.
When to avoid flattening:
- If a significant portion of your mail is forwarded (universities, alumni, corporate re‑routes), flattening won’t help. Invest in DKIM+DMARC and advocate SRS/ARC with partners.
How AutoSPF helps:
- AutoSPF parses DMARC RUA reports to detect abnormal rates of SPF fails paired with DKIM passes post‑forwarding, then recommends ARC adoption for mailing lists and DKIM alignment for critical streams.
SPF policy choices and flattening risks
- -all (hardfail) will cause outright rejection when SPF fails due to stale flattened records.
- ~all (softfail) or ?all (neutral) are safer during periods of change or when adopting DKIM+DMARC enforcement.
When to adjust policy instead of flattening:
- If flattening is only being considered to “satisfy” the 10‑lookup limit but would create a volatile record, keep vendor includes, remove nonessential mechanisms, and run ~all until DKIM alignment is fully enforced.
How AutoSPF helps:
- AutoSPF’s policy advisor simulates outcome deltas for -all vs ~all under your current fail mix and will propose a staged policy that avoids flattening‑induced false rejects.

Failure modes that justify switching strategies
Knowing how flattened SPF fails tells you when to stop using it.
Common flattening failure modes
- DNS timeout: Oversized TXT records cause fragmentation or TCP fallback; under load, receivers time out. Symptom: intermittent permerrors on large messages during peak.
- Lookup limit exceeded: Some flatteners keep a few includes and still trip the 10‑lookup ceiling via nested vendors.
- Stale includes/IPs: Vendors rotate ranges; your static list lags.
- Truncation or mis‑segmentation: Records split into too many 255‑char strings incorrectly formatted by DNS tooling.
Switch strategy when:
- DMARC telemetry shows >1% SPF permerror or >0.3% sudden rises tied to record size changes.
- Your flattened record requires weekly edits to remain current.
- You add IPv6 and the SPF RRset grows past ~1,200–1,600 bytes.
How AutoSPF helps:
- AutoSPF baselines your DMARC pass/fail mix and triggers alerts when error classes correlate with SPF size or churn; one‑click recommendations switch you to include/delegation with DKIM reliance.
Tooling, trust, and automation: picking what not to flatten
Not all flatteners are equal, and sometimes the safest move is to avoid them.
Flattening tools and trust models differ
- Static offline flatteners: Generate ip4/ip6 lists on demand. Risk: staleness between runs.
- Hosted include services: You publish include:_vendor.yourdomain.tld and the service maintains the target record. Trust model: the vendor indirectly controls your SPF content.
- Delegated DNS (NS) per subdomain: Vendor manages SPF for mail.vendor.example.com in their own zone. Strong isolation; minimal coupling.
Avoid third‑party flatteners when:
- They require broad API or DNS write access to your apex.
- They do not provide change‑rate telemetry, IPv6 sizing simulation, or rollback.
- They lack HA/SLAs or publish from shared infrastructure without isolation.
How AutoSPF helps:
- AutoSPF supports all models: safe on‑demand flattening with short TTLs, hosted includes with strict scoping, and delegated‑subdomain blueprints. It documents the trust boundaries and lets you enforce “no external writes” policies.
Operational trade‑offs: automation vs DKIM+DMARC
- Automated flattening can work when IP churn is low and record size remains compact. It is fragile when the environment is dynamic.
- DKIM+DMARC alignment is path‑agnostic and robust against forwarding; once enforced, SPF can be simplified (or even made advisory) without hurting DMARC outcomes.
Decision cue:
- If >80% of your DMARC passes come from DKIM alignment, invest further in DKIM hygiene and relax SPF complexity; avoid aggressive flattening.
How AutoSPF helps:
- AutoSPF’s DMARC engine quantifies “auth authority,” showing what fraction of passes are due to SPF vs DKIM, and recommends the cheapest risk reduction path.
Architectures and multi‑tenant realities
Complex domains benefit from per‑tenant or per‑function scoping instead of global flattening.
Delegated subdomain and multi‑tenant handling
- Per‑tenant subdomains (tenantA.mail.example.com) allow localized SPF records that match each tenant’s ESP and change rate; no need to flatten the apex domain.
- Multi‑tenant ESPs often offer custom return‑path domains; align DKIM and SPF to that subdomain and keep your top‑level SPF simple.
When to avoid flattening:
- If you operate a platform with tenant‑provided senders or 3rd‑party plug‑ins; flattening the apex domain multiplies blast radius.
How AutoSPF helps:
- AutoSPF automatically provisions per‑tenant SPF templates, validates DMARC alignment per subdomain, and warns if a tenant pushes you toward size/lookup danger.
Monitoring without flattening: what to watch
If you choose not to flatten, watch health so that includes and alignment do the work.
Monitoring and alerting practices
- DMARC RUA parsing: Track SPF pass/fail rates by source ASN, envelope domain, and HELO; alert on >0.5% day‑over‑day shifts or vendor‑specific spikes.
- RUF sampling in a sandbox: Review forensic failures to catch routing‑layer anomalies.
- DNS health: Monitor SPF TXT byte size, string count, and include depth after each change.
- Vendor change watch: Subscribe to ESP IP change feeds; compare to DMARC signals.
- IPv6 coverage: Verify that DKIM passes hold for IPv6‑delivered mail.
How AutoSPF helps:
- AutoSPF includes dashboards for RUA/RUF, source‑specific anomaly detection, byte‑size alerts, and vendor change diffing; it can block risky DNS pushes until simulations pass.
Alternatives to flattening, mapped to use cases
This section pairs common scenarios to the right control.
Use include/redirect or subdomain delegation when
- You rely on large ESPs or CDNs with frequent IP rotations.
- IPv6 is in active use by your senders or recipients.
- You operate >5 third‑party senders or a multi‑tenant platform.
AutoSPF note:
- AutoSPF suggests vendor‑managed includes or NS delegation and issues per‑vendor subdomain cut sheets you can share with partners.
Use SRS, DKIM, or ARC (not flattening) when
- Forwarding and mailing lists are common.
- You see SPF fails paired with DKIM passes in DMARC.
AutoSPF note:
- AutoSPF highlights forwarding signatures, recommends SRS to partners, and tracks ARC adoption effect on delivery.
Adjust SPF policy (instead of flattening) when
- You are nearing the 10‑lookup limit but flattening would oversize the record.
- You are mid‑migration or in a change freeze.
AutoSPF note:
- AutoSPF proposes policy stages (~all → -all) with guardrails based on live fail‑type distributions.

Case studies and data insights
Grounded examples illustrate when avoiding flattening improved outcomes.
Case study 1: SaaS with 12 ESPs and heavy IPv6
- Situation: Apex SPF with 9 includes; projected flattened record 1.9 KB, 14 ip6:/ip4: blocks per vendor.
- Action: AutoSPF recommended per‑vendor subdomains and DKIM alignment; apex kept to three core includes.
- Result: DMARC pass rose from 96.1% to 99.0%; SPF permerrors dropped from 1.2% to 0.2%. No flattening used at apex; subdomains allowed simple, vendor‑managed includes.
Case study 2: University with pervasive forwarding
- Situation: Alumni forwarding caused widespread SPF fails; a flattened test worsened false rejects due to staleness.
- Action: Adopted DKIM alignment for all outbound mail, worked with major forwarders on SRS, and enabled ARC on mailing lists.
- Result: DMARC pass improved from 88.7% to 98.3% within 45 days. Flattening was removed; includes simplified to core services.
Case study 3: Retailer mid‑ESP migration
- Situation: Migration created daily IP shifts; flattened staging record went stale within 72 hours.
- Action: AutoSPF switched to migration mode, retained includes, and monitored DKIM alignment; SPF kept at ~all until cutover completed.
- Result: No material deliverability impact; later moved to -all after 14 days of stable alignment.
Decision criteria and operational checklist
Use this as a practical gate before you flatten.
Decision criteria
- Vendor churn rate: If third‑party IPs change faster than your DNS can update (or more than twice per month), do not flatten their ranges.
- Record size: If a flattened projection exceeds ~1,200–1,600 bytes or requires >8 string segments, avoid flattening.
- IPv6 density: If IPv6 adds >40% of byte size or vendor publishes many /48+/64 blocks, avoid flattening.
- Forwarding exposure: If >10% of traffic is forwarded/mailing lists, rely on DKIM/ARC instead.
- DMARC authority: If ≥70–80% of passes come from DKIM, avoid complex SPF strategies; keep it simple.
- Operational posture: During migrations or in highly regulated change regimes, prefer DKIM and delegation.
Operational checklist
- Inventory senders, includes, and change rates (AutoSPF can auto‑discover).
- Simulate flattened vs unflattened: lookups, bytes, IPv6 impact.
- Decide per sender:
- Flatten safely
- Keep include/redirect
- Delegate subdomain
- Rely on DKIM+DMARC (set ~all/-all accordingly)
- Ensure DKIM alignment from each ESP; set DMARC p=quarantine → p=reject when stable.
- For forwarding environments: encourage SRS, deploy ARC on lists, verify DKIM survives list footers.
- Set monitoring: DMARC RUA/RUF, SPF size alerts, vendor change watches.
- Reassess quarterly; remove legacy senders and stale includes.
How AutoSPF operationalizes this:
- AutoSPF builds the sender inventory, runs what‑if simulations, recommends per‑sender actions, prevents risky DNS pushes, and maintains monitoring so you always know when avoiding flattening is the safer option.
FAQs
Does flattening ever make sense for small, stable environments?
Yes, if you have one or two stable on‑prem MTAs and a single ESP with rare IP changes, flattening can eliminate lookup count risk with minimal staleness. AutoSPF will mark these as “low‑churn” and can generate a flattened record with conservative TTLs and automatic refresh.
If I keep includes, how do I avoid the 10‑lookup limit?
Prune unnecessary mechanisms (e.g., avoid broad a or mx for large host sets), consolidate vendors, and use redirect for single‑source domains. AutoSPF’s “smart include” mode calculates the minimal set to fit under 10 lookups without hard‑coding IPs.
Can I rely on SPF alone for DMARC compliance?
No. Because forwarding breaks SPF, DKIM must be first‑class. DMARC passes if either SPF or DKIM aligns; DKIM provides path‑independent assurance. AutoSPF monitors which channel carries your DMARC passes and will guide you to strengthen DKIM when SPF is unreliable.
What about using multiple SPF records?
Do not. Multiple SPF TXT records on the same name cause permerror. Use a single SPF record; if you must split for size, split into multiple strings within the same TXT RRset. AutoSPF validates the final DNS state to prevent multi‑record misconfigurations.
How should I handle IPv6 adoption?
Keep vendor includes for IPv6‑heavy ESPs, favor DKIM alignment, and test delivery to IPv6 recipients. AutoSPF will flag IPv6 bloat and suggest delegation or DKIM‑centric strategies instead of flattening.

Conclusion: Choose the right control for the job—AutoSPF keeps you honest
Avoid SPF flattening when your environment is dynamic (ESPs/CDNs with frequent IP shifts), when IPv6 or many vendors would bloat TXT size, when forwarding is common, during migrations and compliance‑heavy periods, in multi‑tenant/delegated architectures, and whenever DKIM+DMARC can reliably carry authentication. In those cases, rely on vendor includes or redirects, dedicated sending subdomains and delegation, DKIM+DMARC enforcement, SRS at forwarders, and ARC for intermediaries.
AutoSPF exists to make that judgment call precise and safe. It inventories your senders, measures vendor churn, simulates DNS size and lookup counts, quantifies whether SPF or DKIM carries your DMARC, and recommends the lowest‑risk path—often not flattening. When flattening is appropriate, AutoSPF automates it with safe TTLs, rollbacks, and continuous refresh. When it isn’t, AutoSPF steers you to includes, subdomain delegation, DKIM key management, and monitoring that hardens your authentication without fragile DNS gymnastics. The result is robust deliverability built on the right protocol for each risk—and a configuration you can defend in audits and during incident response.