Written by
Published on
Oct 9, 2025
Topic
Engineering
Email authentication isn't just another checkbox on your deployment checklist—it's what stands between you and learning the hard way that “we're too small to be targeted” is a dangerous assumption. This guide breaks down the technical implementation of SPF, DKIM, and DMARC, with real-world context on why each piece matters.
The Authentication Trinity: How They Work Together
Email authentication relies on three complementary protocols, each solving a different piece of the spoofing puzzle:
SPF (Sender Policy Framework) validates the sending IP address. It's a DNS TXT record listing authorized IPs that can send email from your domain. When an email arrives, the receiving server checks if the sending IP matches your SPF record.
DKIM (DomainKeys Identified Mail) adds a cryptographic signature to your emails. Using public/private key pairs, it ensures the message hasn't been tampered with during transit. The signature lives in the email headers and validates both integrity and authenticity.
DMARC (Domain-based Message Authentication, Reporting & Conformance) sits on top of SPF and DKIM, requiring at least one to pass AND align with the visible "From" domain. It also provides two critical capabilities: instructing receivers what to do with failing messages, and sending you detailed reports about authentication results.
Understanding DMARC Alignment
DMARC's alignment requirement often trips up engineers. Here's what’s actually going on:
The visible "From" address (RFC 5322) that users see might be user@acme.com
. But underneath, emails use a different "Mail From" address (RFC 5321) for bounce handling. Often something like user@mail.acme.com
when using an email service provider (ESP).
DMARC considers alignment satisfied if either:
The SPF domain (from Mail From) aligns with the visible From domain
The DKIM signature domain aligns with the visible From domain
"Alignment" means the domains match or share the same organizational domain. You only need one of these to align, not both. This flexibility is crucial when using email service providers that handle bounce processing on their domains.
Common Implementation Mistakes
SPF Pitfalls
Hitting the 10 lookup limit: SPF has a hard limit of 10 DNS lookups per evaluation. Every include:
, a:
, mx:
, and redirect:
mechanism counts toward this limit, and nested lookups count too. Exceed it and SPF fails with PermError—your authentication breaks even though your record looks fine.
Multiple SPF records: You can only have one SPF record per domain. If you need to authorize multiple services, combine them into a single record.
Being too permissive: Using +all
essentially tells the world anyone can send as your domain.
Being too restrictive: Using -all
before proper testing can in some cases block legitimate emails.
Wrong DNS location: Publishing SPF on the From domain instead of the Mail From domain can be a common error, if your mail originates from a different Mail From (very common if you are using an email service provider).
DKIM Issues
The most common problem with DKIM is publishing the public key in the wrong DNS location. To avoid this, use the exact selector and domain specified by your ESP. In Cloudflare, remember to disable proxying for CNAME records used in DKIM.
DMARC Mistakes
Multiple DMARC records: Like SPF, you can only have one DMARC record per domain.
Not collecting reports: A DMARC record without an rua
tag is like deploying monitoring without alerts. You're missing critical visibility into authentication failures and potential abuse.
Moving too fast or too slow: Starting with p=reject
will likely block legitimate emails. But staying at p=none
forever leaves you vulnerable. Advance through each stage carefully and methodically.
DMARC: Not a Set and Forget Solution
The progression path is critical:
Start:
v=DMARC1; p=none
This bare minimum meets current requirements but provides no visibility.
Better start:
v=DMARC1; p=none; rua=some@address.com
The rua
tag specifies where aggregate reports are sent, giving you essential visibility.
Destination: Progress from p=none
(monitoring only) → p=quarantine
(spam folder) → p=reject
(block)
Monitor reports at each stage to ensure legitimate emails aren’t affected before advancing.
Why DMARC Reports Matter
The Problem with Raw DMARC Reports
XML format: Difficult to interpret without experience
High volume: Daily reports quickly become unmanageable
No unified view: Each report shows only a small piece of the puzzle
No trend analysis: Impossible to detect patterns manually
How DMARC Analysis Tools Solve These Issues
Transform XML into clear, easy-to-understand summaries
Process report volume efficiently, handling thousands of reports
Visualize data and trends with charts and timelines
Enable early threat detection with better visibility and continuous improvement
This transformation is essential. Without it, most organizations implement DMARC but never actually use the monitoring capabilities effectively.
Why Authentication is Required
Prevent Spoofing
Proper authentication makes it harder for malicious actors to impersonate legitimate senders. Without it, attackers can easily forge your domain and launch phishing attacks against your company’s employees and customers.
Build Sending Reputation
Authentication is essential for building and preserving trust with receiving mail servers. Mailbox providers can only attach reputation to authenticated domains, making authentication critical for email deliverability.
Comply with Sender Guidelines
Major email providers like Gmail now require authentication, especially for bulk senders. Authentication isn't optional anymore—it's mandatory for reliable email delivery.
The Progressive Implementation Path
Audit your current state: Check existing SPF, DKIM, and DMARC records
Deploy SPF: Authorize only necessary sending IPs, use
~all
Configure DKIM: Follow your ESP's setup exactly and disable Cloudflare proxying for CNAMEs
Start DMARC monitoring: Deploy with
p=none
andrua
tagsAnalyze reports for about 2 weeks: Identify all legitimate sources
Fix authentication issues: Ensure all legitimate emails pass
Progress to
p=quarantine
: Monitor for 1-2 weeksMove to
p=reject
: Full protection once confidentMove SPF to
-all
: Once you’re sure you have everything configured properlyMaintain vigilance: Continue monitoring reports for threats
Advanced Considerations
Subdomain Strategy
While Google suggests differentiating mail streams by local part like notifications@acme.com and support@acme.com, some organizations choose to use subdomains like accounting@app.acme.com and admin@team.acme.com for better isolation and monitoring granularity. However, this approach can add some operational overhead and may not fit neatly with how your company wants to present itself over email. For most use cases, the local part approach is perfectly adequate!
SPF Macros
For organizations that prefer not to expose their sending IP addresses in DNS records, SPF macros can hide these addresses from public view while maintaining proper authentication.
The Bottom Line
Email authentication is your accountability system. It proves you sent what you sent, and equally importantly, proves you didn't send what you didn't send. Without proper authentication:
You're vulnerable to spoofing attacks
Your deliverability will suffer
You'll miss critical features like feedback loops
You're non-compliant with major provider requirements
The technical implementation is straightforward. The challenge is doing it properly, progressively, and with full visibility into what's actually happening with your domain. Start with monitoring, move deliberately, and remember: every domain is a target, regardless of size.
Authentication isn't about immediate deliverability improvement—it's about building the foundation for reputation, security, and long-term email success.
Samuel Beyeler
Security Program Engineer @ Oneleet
Security Program Engineer specializing in cybersecurity compliance. Based in Phoenix, AZ.
Check All Other Articles
Continue reading

Bryan Onel
Oneleet Raises $33M Series A to End Compliance Theater
Oct 2, 2025
We're consolidating security tooling into one platform and ending compliance theater. Instead of ticking boxes to meet minimum requirements, we make companies genuinely secure—compliance follows automatically. Joining Dawn are Frank Slootman (former CEO of Snowflake and ServiceNow), Arash Ferdowsi (co-founder of Dropbox), Y Combinator, and leading founders and CISOs. We're grateful for their…

Jack Novotny
Practical Web Security in React
May 12, 2025
Most frontend engineers have heard of the OWASP top 10, and I would say fewer could list all 10. But working on React frontends in your actual day-to-day work goes beyond just knowing about these vulnerabilities. We take a lot of things for granted that React…

Mona Zimmermann
Achieve EU DORA Compliance: A Clear Path for SMEs
Dec 16, 2024
Data security doesn’t just protect your secrets from prying eyes—it’s the foundation for securing your business’s future. For VC-backed startups, it’s not just…