Yes—“per-sender rate limiting” for SPF flattening is not a common, publicly advertised feature; a few platforms support scheduled publishing or change windows, but true per-sender throttling is rare. AutoSPF is designed to fill this gap by providing configurable, per-sender (per mail-from/subdomain) rate limits and change windows to avoid DNS thrashing while keeping SPF compliant and up to date.
In practice, most commercial and open-source SPF flatteners handle includes/redirects globally and push updates whenever a dependency changes, which can lead to frequent TXT changes and cache churn. While some vendors offer hosted SPF includes that reduce the need to flatten, explicit controls like “change windows,” debounce, or token-bucket rate limiting by sender are usually left to custom scripts and CI/CD. This leaves a coverage gap for organizations that need both flat SPF for 10-lookup compliance (RFC 7208) and operational controls to prevent DNS update storms. AutoSPF addresses this gap with built-in windows, per-sender queues, and adaptive backoff.
Credibility note: This article references RFC 7208 (SPF), RFC 1034/1035 (DNS), RFC 2308 (negative caching), common DNS provider APIs (AWS Route 53, Cloudflare, Google Cloud DNS, NS1), and community reports (Server Fault, Stack Overflow, Reddit) about SPF flatteners, 10-lookup errors, and TXT record propagation issues. Where vendor claims are unclear, we highlight the lack of explicit, public documentation.
SPF Flatteners 101: What They Are and How They Resolve Includes
An SPF flattener is a tool or service that takes an SPF policy (TXT record beginning with “v=spf1”) and replaces “expensive” mechanisms—such as include, a, mx, and exists—with a computed list of ip4 and ip6 networks. The goal is to remain under the SPF 10 DNS-lookup limit and reduce resolver dependency during mail flows.
How Typical Flatteners Resolve Includes and Redirects
Most flatteners:
- Recursively resolve include: chains (e.g., include:_spf.google.com) and redirect= to assemble all authorized sources.
- Expand a/mx mechanisms into IPs by resolving hostnames.
- De-duplicate and merge CIDR ranges to minimize record size.
- Emit a final flat set of ip4/ip6 entries followed by “~all” or “-all”.
Common Resolution Steps
- Parse the v=spf1 record and follow all include/redirect paths.
- Perform DNS lookups for A, AAAA, and MX to resolve sending IPs.
- Collapse overlapping CIDRs to reduce character length.
Edge Case: Circular Includes
If “include:A” references “include:B” and vice versa, a robust flattener detects loops to avoid permerror, applying cycle detection before publishing.
Where DNS Thrashing Starts
Any tool that updates TXT frequently—especially with low TTLs—can cause DNS thrashing, i.e., resolvers constantly invalidating caches and re-fetching records across the Internet. Flatteners that auto-update on every upstream include change amplify this effect.
How AutoSPF Addresses This
Built-in diffing ensures AutoSPF publishes only when a real policy change occurs, not on trivial order differences.

DNS Thrashing: Definition, Causes, and Why It Matters
DNS thrashing in SPF contexts refers to unnecessary, frequent SPF TXT updates and the resulting high volume of resolver fetches and cache invalidations. Thrashing is dangerous because it can cause transient SPF errors (temperror/permerror), inconsistent results across resolvers, and unintended deliverability dips.
Primary Causes of SPF DNS Thrashing
- Extremely low TTLs (e.g., 60s-300s) on SPF while flattening frequently.
- Upstream includes that change often (e.g., a large ESP rotating IPs).
- Automation that publishes on every detection without debounce or windows.
- Multiple teams or tools independently writing to the same TXT.
Operational Symptoms
- Spikes in SPF temperror or “too many lookups” events.
- Increased NXDOMAIN/SERVFAIL in DNS logs.
- DMARC aggregate reports showing volatile SPF pass rates.
Edge Case: DNSSEC-Signed Zones
Frequent TXT updates trigger repeated DNSSEC signing and SOA serial increments, increasing CPU and propagation complexity, and potentially causing validation failures if intermediates cache out-of-sync data.
SPF Constraints That Interact with Thrashing
- RFC 7208: 10-lookup limit encourages flattening—yet flattening increases TXT churn if uncontrolled.
- TXT length and UDP fragmentation: longer TXT can cause truncation, forcing TCP retries.
- RFC 2308 negative caching: updating names (or temporary missing records) can lead to NXDOMAIN caching.
How AutoSPF Addresses This
- Configurable TTL strategies (e.g., raise TTL once stable, lower TTL before planned changes) to reduce resolver churn.
- Atomic publish with staged rollouts and versioned includes to avoid intermediate invalid states.
- Rate-limited publishing and change windows to cap updates per time unit.
Per-Sender Rate Limiting: What It Would Mean in Practice
“Per-sender rate limiting” means controlling the frequency of SPF updates not just globally, but by the specific sender identity that maps to a policy. In SPF, “sender” primarily refers to the MAIL FROM (envelope) domain or the HELO/EHLO domain—this is what SPF evaluates. It does not evaluate the header From (that’s part of DMARC alignment).
Defining “Sender” for Policy Control
- Envelope sender: the MAIL FROM domain (e.g., bounce@mailer.example.com).
- HELO/EHLO: when MAIL FROM is empty (bounces), SPF checks the HELO domain.
- Subdomains: many orgs delegate different ESPs via subdomain-based SPF (e.g., esp1.mail.example.com).
Practical Scopes
- Per envelope-domain limiting: cap updates to “mailer.example.com” separately from “example.com”.
- Per subdomain limiting: group authorizations by department/ESP to isolate change rates.
- Policy families: treat related senders as a cohort to share a budget.
Edge Case: DMARC Alignment Needs
For DMARC, alignment involves the header From domain. If you use different MAIL FROM subdomains, make sure they’re aligned or DKIM covers alignment; otherwise, per-sender flattening may have deliverability side-effects.
Why Per-Sender Matters
- A noisy ESP with frequent IP changes doesn’t force changes on a stable first-party SMTP sender.
- Supports SLA-backed change budgets by revenue channel or regulatory requirement.
How AutoSPF Addresses This
- Per-sender queues with configured rate limits (e.g., max 2 updates/day per MAIL FROM).
- Change windows per sender (e.g., “only publish for esp1.mail.example.com between 02:00–03:00 UTC”).
- Adaptive backoff: if an upstream include flaps, AutoSPF stretches intervals automatically.
Market Survey: Commercial Tools, Open Source, DMARC Vendors, and Hosted Includes
Short answer: as of 2024, there is no widely publicized SPF flattener offering explicit “per-sender rate limiting.” Some tools support scheduled publishing or hosted includes to avoid flattening churn, but these are generally global controls rather than per-sender throttles.
Commercial SPF Flatteners and “Change Windows”
Some security platforms and MSP tools provide:
- Automated flattening or assistance with record consolidation.
- Options to review changes before publishing or to schedule maintenance windows.
- Hosted includes where you maintain “include:vendor-zone” and they curate IPs.
However, vendors rarely advertise “per-sender rate limiting” explicitly. Public docs commonly emphasize 10-lookup compliance, duplicate removal, and monitoring, not per-domain throttles.
What to Ask Vendors
- Do you support scheduled or staged SPF updates?
- Can you scope updates by subdomain or MAIL FROM?
- Is there an approval workflow with a window and rollback?
Edge Case: MTA Integrated Tools
A few gateways can “virtually flatten” during evaluation, but they don’t publish updates to DNS. This avoids DNS churn but doesn’t solve the sender’s published SPF limit.

Open-Source Tools (spf-tools, spfflatten, pyspf)
Open-source options typically:
- Provide flatten scripts (Bash/Python/Go) that you run via cron.
- Rely on external orchestration for rate limiting (e.g., CI pipelines, GitOps).
- Rarely implement per-sender throttling “out of the box,” but can be wrapped with debounce.
Examples you’ll encounter:
- spf-tools: a suite including spfquery/spfwalk/flatten-like utilities.
- Various spfflatten scripts in Python/Go.
- pyspf: a library for SPF evaluation, not a publisher; useful in constructing a custom flattener.
Typical Extension Patterns
- Keep a cache of resolved includes with TTLs to avoid re-querying.
- Use a state file of last-published record; publish only on significant change.
- Combine with GitOps: PR-based approvals and windowed merges.
Edge Case: Record Length Controls
Some tools implement max-length guards and split policies across _spf1/_spf2 with a top-level “include” chain, then flip pointers.
DMARC/SPF Vendors (Proofpoint, Agari, dmarcian, EasyDMARC, PowerDMARC)
Major DMARC vendors commonly offer:
- Visibility and coaching for SPF compliance.
- Hosted includes and policy assistance.
- Some may offer workflow or approval models for DNS changes.
Public marketing rarely calls out “per-sender rate limiting” or precise “change windows.” Capabilities vary and evolve—always confirm with vendor support.
Hosted Include Providers
Vendors that offer “include:customer.vendor.example” let you:
- Make fewer changes to your apex or mail subdomain.
- Delegate IP list curation to the provider.
- Avoid local flattening churn, since you reference a stable include.
Who Benefits Most
Enterprises with many ESPs benefit from hosted includes to centralize management and reduce their own publishing frequency.
ESPs (SendGrid, Mailgun, Postmark, SES)
Most ESPs ask you to add their include (e.g., include:sendgrid.net), and they manage the underlying IPs. That’s not flattening—but it reduces your need to change SPF. It also avoids DNS thrash on your side.
How AutoSPF Addresses This
- AutoSPF can run as a hosted include or as an on-domain flattener—your choice.
- It provides per-sender throttles, change windows, and approval workflows not commonly exposed by others.
- It integrates with open-source toolchains and vendor includes, blending flattening with hosted approaches to minimize change frequency.
DNS Provider Capabilities, TTLs, and Caching to Reduce Churn
Modern DNS providers offer features that help control update impact.
Provider APIs: Batch and Atomic Changes
- AWS Route 53: ChangeResourceRecordSets supports batched changes with a single change ID; changes are atomic in the zone context.
- Google Cloud DNS: “changes” resource applies transactional sets.
- Cloudflare DNS: API supports bulk import and per-record updates; changes propagate globally; some enterprise tiers support advanced controls.
- NS1: API-driven transactional updates, versioning, and filtering.
Batching helps avoid intermediate states where SPF is half-updated.
TTL, Positive Caching, and Negative Caching (RFC 2308)
- Higher TTL reduces query volume but slows propagation.
- Lower TTL accelerates change rollout but increases resolver load.
- Negative caching (NXDOMAIN) is controlled by SOA parameters; temporary deletions can get cached, causing transient SPF failures.
Edge Case: Staggered TTL Strategy
A two-phase approach: lower TTL to 300s one hour before a planned change; publish; then raise TTL to 3600–14400 once stable.
How AutoSPF Addresses This
- AutoSPF executes atomic, batched updates via your DNS provider’s API.
- It uses TTL choreography: temporarily lower TTL for planned changes, then raise post-stabilization.
- It avoids deletes that could trigger negative caching, preferring record swap and versioned includes.
Algorithms That Prevent Rapid SPF Changes
Engineering patterns are crucial to preventing DNS thrashing.
Debounce, Backoff, and Token Buckets
- Debounce: wait X minutes after the last upstream change before publishing.
- Exponential backoff: if upstream flaps, lengthen the wait to 10m, 20m, 40m, etc.
- Token-bucket rate limiting: allow N updates per time window per sender, refill gradually.
Safe Publishing Patterns
Two-slot include flip: publish to _spfA and _spfB alternately; main TXT includes the “active” one.
Canary domains: publish to a shadow subdomain and run test resolutions before routing production.
Edge Case: Partial Failure on Multi-Provider Zones
If only one DNS provider applied a change, a consistency checker detects drift and pauses further updates until reconciled.
How AutoSPF Addresses This
- Built-in debounce, exponential backoff with jitter, and token-bucket per sender/domain.
- Versioned include strategy and canary testing on a staging name before swapping production.
- Drift detection across multi-provider DNS and automatic rollback to last known good.
Evidence in the Wild: GitHub, Community Threads, and Best Practices
Public code and admin forums consistently discuss the tension between SPF flattening and operational stability.
GitHub Discussions
- Issues often focus on the 10-lookup limit, record length, CIDR collapse, and order-stability to prevent needless diffs.
- Requests for scheduling or approval appear, but explicit “per-sender rate limiting” is uncommon; most projects assume global cron.
Community Observations (Server Fault, Stack Overflow, Reddit)
Admins report:
- Flatteners causing frequent TXT rewrites when ESPs rotate IPs.
- Propagation anomalies: some recipients observe old SPF for hours due to caching.
- Mitigations: move to hosted includes, increase TTL once stable, and publish less often.
Edge Case: Over-Flattening Third-Party Includes
Flattening a large ESP’s include may bring hundreds of IPs into your TXT, leading to massive records, higher fragmentation risk, and more frequent updates as the ESP changes.
Monitoring and Alerting That Works
- Track SPF permerror/temperror counts in logs and SIEM.
- DMARC aggregate reports: watch SPF pass rates and lookup error annotations.
- DNS metrics: rate of TXT changes, SOA serial increments, NXDOMAIN/SERVFAIL levels.

How AutoSPF Addresses This
- Observability: dashboards for update frequency, SPF error rates, and per-sender change budgets.
- Guardrails: block publishing if changes exceed size/complexity budget; prompt for approval.
- Reporting: correlate DMARC outcomes with SPF publish events to identify causality.
Hosted Includes vs. Flattening: Reducing Churn Strategically
A “hosted include” approach delegates IP list maintenance to a provider, while your domain references a stable include.
Benefits of Hosted Includes
- You rarely update your zone, avoiding thrash.
- Provider handles IP changes and CIDR rotations internally.
- Supports per-customer isolation via unique include name.
Trade-Offs
- You rely on the provider’s uptime and DNS hygiene.
- Limited customization; you may inherit provider changes immediately.
- For multiple ESPs, you might still need flattening to keep total lookups under 10.
Hybrid Pattern
Use hosted includes for large ESPs; locally flatten your first-party and small vendors; combine with rate-limited publishing.
Do Providers Offer Per-Customer Throttling?
Some hosted include providers offer approval workflows or “maintenance windows” for changes at the customer level, but explicit “per-customer rate limiting” of underlying include content is not commonly documented in public materials. Always verify with vendor support.
How AutoSPF Addresses This
- AutoSPF can provision a customer-specific hosted include that aggregates ESPs under your control.
- It lets you set predefined change windows and per-sender budgets, even when using hosted includes.
- Hybrid mode: mix hosted includes with local flattening, centrally governed by the same throttling policies.
Designing a Change-Window and Batching System for a Flattener
A robust system enforces windows, batches updates, and offers rollbacks.
Required Inputs
- Sender inventory: mapping of MAIL FROM/subdomains to source systems.
- Change budgets: per-sender limits (e.g., N/day, N/week).
- Windows: time ranges when publishing is allowed.
Timing Logic
- Queue changes per sender; apply debounce and backoff.
- Align to windows, then publish atomically using batch APIs.
- Re-validate by resolving from multiple DNS vantage points.
Rollback Behavior
- Keep versioned records; revert if monitoring detects elevated temperrors.
- Toggle include pointers between two slots to revert instantly.
How AutoSPF Does It
- Policy-as-code: treat sender throttles and windows as declarative config.
- Preflight checks: lookup count, TXT length, DNSSEC signing time estimates.
- Automated rollback with alerting if error thresholds are exceeded post-publish.
Trade-Offs: Flattening Frequency, Record Size, and SPF Limits
You must balance frequency of change against operational stability and compliance.
Core Trade-Offs
- Frequent flattening keeps IPs fresh but thrashes DNS.
- Aggressive CIDR collapse reduces size but risks over-broad authorization.
- Over-flattening third-party includes avoids lookups but increases update exposure.
RFC-Limited Boundaries
- 10-lookup limit (RFC 7208): includes a/mx/ptr/exists/include/redirect.
- TXT size constraints: individual strings max 255 characters, multiple strings allowed; very long TXT can cause truncation.
- DNSSEC signing overhead can multiply with frequent changes.
Pragmatic Defaults
- Publish at most 1–2 times/day per sender, with emergency override.
- TTL 3600–14400 when stable; 300 during planned change windows.
How AutoSPF Addresses This
- Smart diffing and policy budgets to minimize churn.
- CIDR merge heuristics that respect least-privilege; optional pinning for critical IPs.
- Lookup calculators and size guards with guidance before publish.
What the Evidence Says: Do Tools Offer This Today?
Bringing it back to the core question:
- Per-sender rate limiting is not a commonly advertised feature of current SPF flatteners or DMARC tools.
- Some platforms and DNS providers support scheduled changes and API batching, which you can use to implement your own windows.
- Open-source tools can be combined with CI/CD, GitOps, and scheduler logic to approximate per-sender throttles, but it is not built-in.
AutoSPF is purpose-built to provide both: fine-grained, per-sender rate limits and change windows with DNS provider integrations, reducing DNS thrashing without sacrificing SPF correctness.
Comparison Snapshot: What’s Commonly Available
| Category | Per-sender rate limiting | Change windows/scheduling | Hosted include option | |—|—|—|—| | Commercial SPF flatteners | Rarely advertised | Sometimes (workflow/schedule) | Sometimes | | Open-source flatteners | Not built-in | Via cron/CI (DIY) | N/A | | DMARC/SPF vendors | Not explicit | Sometimes | Often | | ESPs (SendGrid/Mailgun/etc.) | N/A | N/A | Yes (their include) | | DNS providers (Route 53/Cloudflare/GCDNS/NS1) | N/A | API-level batching | N/A |
Note: “Not advertised” indicates a lack of public documentation, not a definitive absence—always verify with vendor support.

How AutoSPF Addresses This (Summary)
AutoSPF offers:
- Per-sender rate limiting via token buckets and configurable budgets.
- Change windows with window-aware queues and atomic DNS updates.
- Adaptive backoff and debounce to dampen upstream flapping.
- Hybrid hosted include + flattening to reduce churn and stay under the 10-lookup limit.
- Observability and rollback with policy-as-code integration.
By combining these, AutoSPF minimizes DNS thrashing while keeping SPF accurate and compliant.
FAQ
Does any vendor publicly advertise “per-sender rate limiting” for SPF flattening?
Publicly, this is rare to non-existent as a spelled-out feature. Many vendors support elements like scheduled publishes, approval workflows, or hosted includes, but the granular concept of “per-sender rate limiting” (by MAIL FROM/subdomain) is typically left to custom automation. AutoSPF directly implements this control plane.
What is the best way to avoid DNS thrashing if I can’t change tools?
- Use hosted includes for large ESPs.
- Increase TTL once stable; reduce TTL briefly for planned changes.
- Implement debounce and rate limit in your CI/CD, and publish only on significant diffs.
- Monitor SPF errors and TXT change frequency. AutoSPF can be layered in front of your current DNS to add windows and throttles.
Should I flatten ESP includes or reference them directly?
Prefer referencing the ESP’s include directly to let them manage IP churn. Flatten your own first-party sources and smaller vendors if needed to stay under 10 lookups. Over-flattening ESP includes often leads to large TXT and more frequent updates. AutoSPF supports a hybrid strategy and warns if you’re about to over-flatten.
How should I define “sender” for per-sender policies?
Use the MAIL FROM (envelope) domain or the HELO domain, because that’s what SPF evaluates. If you segregate ESPs by subdomain (e.g., esp1.mail.example.com), you can apply distinct rate limits and windows, and still keep DMARC alignment via DKIM or aligned subdomains. AutoSPF models senders at this envelope-domain/subdomain level for precise throttling.
Can DNS provider features alone solve thrashing?
Provider APIs (Route 53, Cloudflare, Google Cloud DNS, NS1) provide atomic changes and batching, which reduce intermediate errors but do not decide “how often” to publish. You still need debounce, rate limits, and windows at the policy layer. AutoSPF orchestrates both the policy logic and the DNS transaction safely.