Over 70% of custom business domains deploy an SPF record ending in ~all (Softfail) alongside a DMARC policy of p=none.
When queried, domain administrators almost universally explain: "We use ~all and p=none so that legitimate third-party transactional mail doesn't accidentally get dropped."
In practice, this configuration provides zero cryptographic protection. It acts as an open invitation for spoofing, phishes, and reputation contamination.
Here is an architectural breakdown of why SPF Softfail fails, how email forwarding breaks authentication, and how to safely navigate a zero-downtime migration to p=reject.
1. The Mechanics: Hardfail (-all) vs. Softfail (~all)
RFC 7208 defines the Sender Policy Framework. When an inbound Mail Transfer Agent (MTA)—such as Google Workspace or Microsoft 365—receives an SMTP connection, it queries the TXT record of the domain declared in the SMTP MAIL FROM envelope (Return-Path).
-
-all(Hardfail): The receiving MTA evaluates IP addresses not listed in the mechanism as explicitly unauthorized. The receiving server can reject the SMTP connection at the edge with a550 5.7.26bounce code. -
~all(Softfail): The receiving MTA tags the email header withReceived-SPF: softfail, but accepts the message body anyway. The spam filter then uses this tag as a minor Bayesian scoring penalty rather than an outright rejection.
Attackers know that high-reputation domains (SaaS companies, agencies, local businesses) often have strong domain authority. An email with a Softfail header from an established domain frequently lands directly in the recipient's primary inbox or junk folder with rendering intact, allowing spear-phishing campaigns to succeed.
2. The Forwarding Trap: Why SPF Alone Cannot Protect You
Many engineers wonder: "Why not just put -all on every SPF record?"
The fundamental flaw of SPF is that it authenticates the connecting IP address, not the message payload. When an email user sets up automatic forwarding (e.g., from a university address to Gmail, or through an alumni mailing list):
Sender (IP: 198.51.100.1) --> Forwarder MTA (IP: 203.0.113.50) --> Final Recipient MTA (Google Workspace) Google receives the connection from 203.0.113.50. Because the forwarder's IP address is not inside the original sender's SPF record, SPF evaluates to fail. If the sender had published -all, legitimate forwarded emails would be rejected.
This is why DKIM (DomainKeys Identified Mail, RFC 6376) and DMARC (RFC 7489) exist. DKIM attaches a cryptographic signature (DKIM-Signature) to the email headers and body hash. Forwarding MTAs typically do not alter the signed headers or message body, allowing the DKIM cryptographic verification to survive intermediate transit intact.
3. The 10-DNS-Lookup Limit (RFC 7208 Section 4.6.4)
Another common failure line in enterprise DNS is exceeding the 10-DNS-lookup limit:
v=spf1 include:_spf.google.com include:sendgrid.net include:mailgun.org include:servers.mcsv.net ~all Every include, a, mx, ptr, and redirect mechanism triggers a separate recursive DNS query. If evaluating your SPF record requires more than 10 DNS queries:
- Receiving MTAs immediately flag an SPF
PermError(Permanent Error). - Under strict receiving rules, a
PermErroris treated as authentication failure, sending legitimate corporate mail into spam.
To check your mechanism depth:
dig TXT yourdomain.com +short Recursively audit every nested include to verify your total query count never exceeds 10.
4. The Path to DMARC p=reject Without Dropping Mail
DMARC unites SPF and DKIM through Identifier Alignment. For DMARC to pass, either SPF or DKIM must not only pass authentication, but the domain authenticated must match the domain in the visible From: header.
To migrate safely from an open posture to full enforcement:
Phase 1: Aggregate Monitoring (p=none)
Publish an aggregate reporting address (rua) so MTAs across the world send daily XML telemetry detailing who is sending email on your behalf:
_dmarc.yourdomain.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; pct=100; sp=none;" Phase 2: Ingest and Audit Telemetry
Inspect the daily XML reports. Identify every legitimate service:
- Transactional billing (Stripe, SendGrid, Postmark)
- CRM & Marketing (HubSpot, Mailchimp)
- Internal application alerts & monitoring servers
For each service, configure dedicated custom DKIM selectors (CNAME records pointing to the vendor's key rotation infrastructure) rather than relying solely on SPF includes. This guarantees DMARC passes via DKIM alignment even if SPF breaks during forwarding.
Phase 3: Staged Quarantine (p=quarantine)
Once 99%+ of valid traffic shows passing DKIM alignment in your reports, update your policy to quarantine:
_dmarc.yourdomain.com. IN TXT "v=DMARC1; p=quarantine; pct=25; rua=mailto:dmarc-reports@yourdomain.com;" Gradually increase pct from 25 to 50, and finally to 100 over a 2-week observation window. Unauthenticated mail will be quarantined to spam rather than delivered.
Phase 4: Full Enforcement (p=reject)
Once quarantine telemetry shows zero legitimate traffic being caught, enforce full cryptographic rejection:
_dmarc.yourdomain.com. IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc-reports@yourdomain.com; aspf=r; adkim=r;" At this stage, receiving MTAs globally will drop spoofed emails at the SMTP boundary before they can ever reach an inbox.
Conclusion
SPF ~all is a transition tool from 2006, not a modern security posture. By implementing DKIM across all sending services and methodically raising your DMARC policy from p=none to p=reject using real aggregate report telemetry, you eliminate domain spoofing entirely without dropping a single legitimate transactional message.
Audit your MCP server tools for prompt injection & secret leaks free: https://mcpaudit.pages.dev/?src=devto


