Email spoofing costs businesses billions every year. Learn how SPF, DKIM, and DMARC work together to protect your domain from phishing — with DNS record examples you can copy.
Anay Pandya
1,254 words
Anay Pandya
Founder of ZeriFlow · 10 years fullstack engineering · About the author
Key Takeaways
Every day, billions of emails are sent pretending to be from domains they do not belong to. An attacker can send an email that appears to come from your-company.com, complete with your brand name in the From field, and most recipients will not notice the difference. This is email spoofing, and it is the foundation of phishing attacks.
<div class="zf-stat-callout" style="background:#0d1117;border:1px solid rgba(16,185,129,0.25);border-left:3px solid #10b981;border-radius:4px;padding:16px 20px;margin:24px 0"> <p style="margin:0 0 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:0.15em;color:#10b981;font-family:monospace">ZeriFlow Data — 12,400+ sites analyzed</p> <p style="margin:0;font-size:13px;color:#e2e8f0;line-height:1.6;font-family:monospace">ZeriFlow data from 12,400+ domains: 61% have no DMARC policy, and of those with one, 79% use p=none — providing visibility but zero enforcement against email impersonation.</p> </div>
Keep reading
Is your site actually secure?
Run a free check — 60 seconds
Three DNS-based protocols exist to stop this: SPF, DKIM, and DMARC. Together, they allow receiving mail servers to verify that an email genuinely came from your domain. When properly configured, they prevent spoofing, improve your email deliverability, and protect your brand reputation.
This guide explains how each protocol works, how to configure them, and the common mistakes that undermine their effectiveness.
Email spoofing is not just an annoyance. It has real business consequences:
SPF lets you publish a list of IP addresses and servers that are authorized to send email on behalf of your domain. When a receiving server gets an email from your domain, it checks the SPF record to verify the sender.
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 -allBreakdown:
v=spf1 — Version identifier (required)include:_spf.google.com — Authorize Google Workspace serversinclude:sendgrid.net — Authorize SendGrid for transactional emailsip4:203.0.113.5 — Authorize a specific IP address-all — Reject all other senders (hard fail)Qualifier options:
-all (hard fail) — Unauthorized senders should be rejected. Recommended.~all (soft fail) — Unauthorized senders should be flagged but not rejected. Use during initial setup.?all (neutral) — No policy. Provides no protection.DKIM adds a cryptographic signature to outgoing emails. The receiving server can verify this signature using a public key published in your DNS. This proves the email was not modified in transit and genuinely came from your infrastructure.
selector._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAA..."Breakdown:
selector — A name you choose (e.g., google, sendgrid, default)_domainkey — Required subdomainv=DKIM1 — Versionk=rsa — Key typep=... — Public key (base64 encoded)DMARC ties SPF and DKIM together and tells receiving servers what to do when authentication fails. It also provides reporting so you can monitor who is sending email on behalf of your domain.
_dmarc.example.com TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; pct=100"Parameters:
v=DMARC1 — Version (required)p=reject — Policy for failures: none (monitor), quarantine (spam folder), or reject (block)rua=mailto:... — Address for aggregate reportspct=100 — Apply policy to 100% of emailsDo not jump straight to p=reject. Follow this graduated approach:
p=none; rua=mailto:dmarc@example.com — Monitor only. Review reports to identify all legitimate senders.p=quarantine; pct=25 — Start quarantining 25% of failing emails. Watch for false positives.p=quarantine; pct=100 — Quarantine all failures. Verify no legitimate email is affected.p=reject; pct=100 — Full protection. Unauthorized emails are rejected outright.DMARC aggregate reports are XML files sent to the address in your rua tag. They show:
Use a DMARC report analyzer (many free options exist) to parse these reports into readable dashboards.
You can verify your email authentication configuration in several ways:
Properly configuring SPF, DKIM, and DMARC takes about an hour and protects your domain indefinitely. It is one of the highest-ROI security investments any business can make. Run a free ZeriFlow scan to see where your email authentication stands today.
<!-- zf-internal-links -->
Related resources
Website Vulnerability Scanner
Run a broader website security audit across headers, TLS, DNS, cookies, SEO, and disclosure checks.
Security Headers Checker
Check CSP, HSTS, X-Frame-Options, and other response headers.
SSL Checker
Review TLS certificate, HTTPS, and transport security signals.
DMARC Checker
Validate email authentication records for domain spoofing protection.
CSP Checker
Review Content-Security-Policy coverage and common gaps.
March 16, 2026
SSL Labs Alternative: What SSL Labs Tests and What It Doesn't Tell You
Monitor your security score
Schedule recurring scans and catch regressions after deployments.