If your company sends corporate mail through Google Workspace or Microsoft 365, transactional mail through SendGrid, and marketing/support mail through HubSpot or Zendesk, your root SPF TXT record is almost certainly one include: away from silent email delivery failure.
Under RFC 7208 Section 4.6.4, receiving mail servers (Gmail, Outlook, Yahoo, Fastmail) enforce a hard ceiling of 10 DNS-querying mechanisms (include, a, mx, ptr, exists, redirect) across the entire recursive evaluation tree. Hit 11 lookups and mail receivers return SPF PermError — causing DMARC alignment failures and legitimate customer invoices/password resets to land in spam.
Below is the exact math, why you don't need an $89/mo hosted Dynamic DNS macro in your live SMTP path, and how to enforce <10 lookups deterministically in GitHub Actions with SPFGuard (v1.2.0, MIT).
1. The Hidden Recursive Lookup Math (Why 5 include:s = 12 Lookups)
Engineers routinely count top-level mechanisms and think they are safe at 5:
v=spf1 include:_spf.google.com include:spf.protection.outlook.com include:sendgrid.net include:mail.zendesk.com include:hubspotemail.net ~all In reality, each provider nests additional DNS lookups underneath:
| Mechanism | Recursive DNS Lookups Consumed |
|---|---|
include:_spf.google.com (_netblocks, _netblocks2, _netblocks3) | 4 |
include:spf.protection.outlook.com (spfa / spfb) | 2 |
include:sendgrid.net | 2 |
include:mail.zendesk.com | 2 |
include:hubspotemail.net | 2 |
| Total Evaluated by Gmail / Outlook | 12 / 10 (SPF PermError) |
2. Diagnose Your Domain in 1 Click (Zero Login, Real DNS-over-HTTPS)
Before touching Terraform or Cloudflare DNS, run a live recursive lookup tree check right in your browser (or via curl):
- 1-Click Live SPF & MTA-STS Diagnostic: Run SPFGuard Live Flattener
- Live Zero-Login Remote MCP Endpoint (for Claude Code & Cursor): Test Remote MCP Server
Or call the deterministic Edge API directly with curl:
curl -sS -X POST "https://specgate.profalexandrezamboni.workers.dev/api/v1/spfguard/analyze?format=sarif" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com", "spf_record": "v=spf1 include:_spf.google.com include:spf.protection.outlook.com include:sendgrid.net include:mail.zendesk.com include:hubspotemail.net ~all" }' 3. GitOps Pre-Merge CI Gate (Zero 3rd-Party DNS Single Point of Failure)
Hosted Dynamic SPF SaaS vendors ($35–$100+/mo) solve the 10-lookup limit by replacing your SPF record with a CNAME or macro pointing at their nameservers — putting a third-party vendor directly in your live SMTP resolution path.
With GitOps flattening, your authoritative Cloudflare or AWS Route53 DNS stays 100% under your own Terraform/Git control, paired with a weekly scheduled GitHub Action to catch ESP IP rotations cleanly:
name: SPF 10-Lookup & MTA-STS Gate on: pull_request: paths: - "dns/**" schedule: - cron: "0 8 * * 1" permissions: contents: read security-events: write jobs: spfguard: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v5 - name: Run SPFGuard RFC 7208 Check & Export OASIS SARIF v2.1.0 run: | uvx --from git+https://github.com/profalexandrezamboni-ui/spfguard-cli@v1.2.0 \ spfguard-cli \ --domain example.com \ --spf "v=spf1 include:_spf.google.com include:spf.protection.outlook.com include:sendgrid.net include:mail.zendesk.com include:hubspotemail.net ~all" \ --format sarif > spfguard.sarif - name: Upload SARIF to GitHub Security Tab if: always() uses: github/codeql-action/upload-sarif@v3 with: sarif_file: "spfguard.sarif" 4. Honest Trade-Offs: When to Use Subdomain Isolation vs. Hosted Dynamic SPF vs. SPFGuard
- Best first step (always free): move bulk marketing/support ESPs onto dedicated subdomains (
mail.example.com,support.example.com) so each subdomain gets its own fresh 10-lookup budget. - When to choose EasyDMARC / dmarcian: if non-technical admins need a hosted DMARC XML (
rua/ruf) forensic inbox dashboard. When to choose SPFGuard: if your DNS lives in Git/Terraform (Cloudflare, Route53) and you want deterministic
<10lookup enforcement, RFC 8461 MTA-STS + RFC 8460 TLS-RPT policy generation, OASIS SARIF v2.1.0 alerts, and predictable flat pricing ($0 Free for up to 2 domains, optional $19/mo Starter for 15 domains, $39/mo Team for unlimited domains).GitHub Marketplace Action: SPFGuard RFC 7208 Analyzer & Flattener
Official MCP Registry (
io.github.profalexandrezamboni-ui/specgate):claude mcp add --transport http specgate https://specgate.profalexandrezamboni.workers.dev/mcpSource Code (MIT):
profalexandrezamboni-ui/spfguard-cli
