SPF, DKIM, and DMARC Explained: Email Authentication for Beginners
SPF, DKIM, and DMARC Explained: Email Authentication for Beginners
Email authentication might sound technical, but it's essential for getting your emails delivered. Without proper authentication, your emails are more likely to land in spam—or be rejected entirely.
This guide explains SPF, DKIM, and DMARC in plain English, with step-by-step instructions.
Why Email Authentication Matters
Email authentication helps receiving servers verify that:
- You are who you claim to be
- Your email hasn't been tampered with
- You've authorized the sending server
Without authentication:
- 📧 Higher spam folder rates
- 🚫 Emails may be rejected
- ⚠️ Vulnerable to spoofing attacks
With authentication:
- ✅ Better inbox placement
- 🛡️ Protection against phishing
- 📈 Improved sender reputation
The Three Pillars of Email Authentication
1. SPF (Sender Policy Framework)
What it does: Specifies which mail servers are allowed to send email on behalf of your domain.
How it works:
- You add a DNS TXT record listing authorized servers
- Receiving server checks if the sending IP is in your list
- If yes → Pass. If no → Fail.
Example SPF Record:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
Breakdown:
v=spf1- SPF versioninclude:_spf.google.com- Allow Google's serversinclude:sendgrid.net- Allow SendGrid~all- Soft fail for all other servers
SPF Qualifiers:
+all- Allow all (never use this!)-all- Hard fail unauthorized servers~all- Soft fail (recommended while testing)?all- Neutral (no assertion)
2. DKIM (DomainKeys Identified Mail)
What it does: Adds a digital signature to your emails that proves they haven't been modified.
How it works:
- Your email server signs the email with a private key
- Public key is published in your DNS
- Receiving server uses the public key to verify the signature
Example DKIM DNS Record:
selector._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=MIGfMA0GCS..."
Breakdown:
selector- Identifies which key to use (set by your email provider)v=DKIM1- DKIM versionk=rsa- Key typep=...- Your public key
Where to get your DKIM key:
- Your email service provider (ESP) generates it
- Add the provided DNS record to your domain
3. DMARC (Domain-based Message Authentication, Reporting & Conformance)
What it does: Tells receiving servers what to do when SPF or DKIM fails, and sends you reports.
How it works:
- Email is checked against SPF and DKIM
- DMARC policy determines action on failure
- Reports are sent to your specified email
Example DMARC Record:
_dmarc.yourdomain.com TXT "v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com"
Breakdown:
v=DMARC1- DMARC versionp=none- Policy (none/quarantine/reject)rua=mailto:...- Where to send aggregate reports
DMARC Policies:
p=none- Monitor only, no actionp=quarantine- Send to spamp=reject- Block the email
Recommended progression:
- Start with
p=noneto collect data - Move to
p=quarantineafter fixing issues - Eventually use
p=rejectfor full protection
Step-by-Step Setup Guide
Step 1: Check Current Authentication
Before making changes, check your current status:
- Send a test email
- Check email headers for authentication results
- Use EmailTestLab to verify SPF, DKIM, and DMARC
Step 2: Set Up SPF
-
Identify all services that send email as your domain:
- Email marketing platforms (Mailchimp, SendGrid, etc.)
- CRM systems
- Transactional email services
-
Create your SPF record:
v=spf1 include:[provider1] include:[provider2] ~all
- Add to DNS as a TXT record:
- Host:
@(root domain) - Type: TXT
- Value: Your SPF record
- Host:
Step 3: Set Up DKIM
-
Get DKIM records from your ESP:
- Most providers have a settings page for this
- They'll give you DNS records to add
-
Add DNS records:
- Usually a CNAME or TXT record
- Selector name varies by provider
-
Enable DKIM signing:
- Some providers do this automatically
- Others require you to toggle it on
Step 4: Set Up DMARC
- Start with monitoring:
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
-
Add DNS record:
- Host:
_dmarc - Type: TXT
- Value: Your DMARC record
- Host:
-
Monitor reports for 2-4 weeks
-
Gradually increase enforcement:
v=DMARC1; p=quarantine; pct=25; rua=mailto:dmarc@yourdomain.com
Common Authentication Problems
Problem: SPF "Too Many DNS Lookups"
SPF allows maximum 10 DNS lookups. If you exceed this:
Solution:
- Use
ip4:andip6:directly where possible - Flatten your SPF record using online tools
- Consider SPF macro syntax for advanced setups
Problem: DKIM Signature Invalid
Common causes:
- Email content was modified in transit
- Wrong selector in DNS
- Key mismatch
Solution:
- Verify DNS record matches ESP settings
- Check for email forwarding services modifying content
Problem: DMARC Reports Show Failures
Solution:
- Identify unauthorized senders in reports
- Add legitimate senders to SPF
- Set up DKIM for all sending services
Testing Your Authentication
Manual testing is time-consuming. EmailTestLab automatically checks your email authentication:
- ✅ SPF record validation
- ✅ DKIM signature verification
- ✅ DMARC policy checking
- ✅ Clear pass/fail indicators
Check Your Email Authentication →
Quick Reference
| Record | Purpose | Example Host |
|---|---|---|
| SPF | Authorize senders | @ |
| DKIM | Sign emails | selector._domainkey |
| DMARC | Set policy | _dmarc |
Conclusion
Email authentication is crucial for deliverability. Here's your action plan:
- Set up SPF - List all authorized senders
- Configure DKIM - Add signatures to your emails
- Implement DMARC - Start with
p=noneand monitor - Test regularly - Verify your setup works
Verify your email authentication instantly with EmailTestLab - see your SPF, DKIM, and DMARC status in seconds.
EmailTestLab Team
Helping you send better emails with comprehensive testing and validation.