Understanding SPF, DKIM, and DMARC Records
Email authentication records — SPF, DKIM, and DMARC — are essential DNS entries that protect your domain from spoofing, phishing, and spam. Without them, your legitimate emails may land in spam folders or be rejected entirely. This guide explains what each record does and how to set them up.
Why Email Authentication Matters
Anyone can forge the "From" address in an email. Without authentication, attackers can send emails pretending to be from your domain. Email authentication solves this by letting receiving mail servers verify that a message truly came from your domain's authorized servers.
Benefits of proper email authentication:
- Improved deliverability — Emails are less likely to be flagged as spam
- Brand protection — Prevents others from impersonating your domain
- Compliance — Many email providers (Gmail, Outlook) now require SPF and DKIM
- Visibility — DMARC reports show you who is sending email on your behalf
SPF (Sender Policy Framework)
What SPF Does
SPF lets you specify which mail servers are authorized to send email on behalf of your domain. It is published as a TXT record in your DNS.
How to Set Up SPF
- Log in to your DNS management panel
- Create a new TXT record for your root domain (
@) - Set the value to your SPF policy
Example SPF record:
v=spf1 include:_spf.yourmailprovider.com ~allBreakdown:
| Part | Meaning |
|---|---|
v=spf1 | Identifies this as an SPF record |
include:_spf.provider.com | Authorizes your mail provider's servers |
a | Authorizes the server at your domain's A record |
mx | Authorizes servers listed in your MX records |
~all | Soft-fail for unauthorized senders (recommended starting point) |
-all | Hard-fail — reject unauthorized senders (stricter) |
Tip: Start with
~all(soft-fail) and move to-all(hard-fail) after confirming everything works correctly.
Common SPF Mistakes
- Multiple SPF records — You can only have ONE SPF TXT record per domain. Combine all sources into a single record.
- Too many DNS lookups — SPF allows a maximum of 10 DNS lookups. Each
include:counts as one lookup. - Forgetting third-party senders — If you use services like Mailchimp or Google Workspace, include their SPF entries.
DKIM (DomainKeys Identified Mail)
What DKIM Does
DKIM adds a digital signature to every outgoing email. The receiving server verifies this signature against a public key published in your DNS, confirming the email was not tampered with in transit.
How to Set Up DKIM
- Generate DKIM keys — Your email hosting provider typically does this. In your control panel, look for a DKIM or Email Authentication section.
- Publish the public key — Add a TXT record in your DNS:
| Field | Value |
|---|---|
| Type | TXT |
| Host/Name | default._domainkey (or the selector your provider specifies) |
| Value | The DKIM public key string (starts with v=DKIM1; k=rsa; p=...) |
| TTL | 3600 |
- Enable DKIM signing — Ensure DKIM signing is enabled in your email hosting control panel.
Tip: The selector name (e.g.,
default,s1) is chosen by your mail provider. Check their documentation for the correct selector.
Verifying DKIM
Send a test email to a Gmail account, then open the email and click Show Original. Look for DKIM: PASS in the authentication results.
DMARC (Domain-based Message Authentication, Reporting, and Conformance)
What DMARC Does
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 from your domain.
How to Set Up DMARC
Add a TXT record in your DNS:
| Field | Value |
|---|---|
| Type | TXT |
| Host/Name | _dmarc |
| Value | v=DMARC1; p=none; rua=mailto:[email protected]; pct=100 |
| TTL | 3600 |
DMARC Policy Options:
| Policy | Action |
|---|---|
p=none | Monitor only — no action on failures (start here) |
p=quarantine | Send failing emails to spam folder |
p=reject | Reject failing emails outright (strongest protection) |
Recommended Rollout Strategy
- Week 1–4: Set
p=noneand monitor DMARC reports - Week 5–8: Move to
p=quarantinewithpct=25(apply to 25% of failures) - Week 9–12: Increase to
pct=100 - Week 13+: Move to
p=rejectfor full protection
Verifying All Three Records
Use these command-line checks:
# Check SPF
dig TXT yourdomain.com +short
# Check DKIM
dig TXT default._domainkey.yourdomain.com +short
# Check DMARC
dig TXT _dmarc.yourdomain.com +shortOr use online tools like MXToolbox, Google Admin Toolbox, or mail-tester.com.
Troubleshooting
| Problem | Solution |
|---|---|
| SPF: too many lookups | Reduce include: statements or use SPF flattening |
| DKIM: signature not found | Verify the selector name and ensure DKIM is enabled |
| DMARC: no reports received | Check the rua email address is valid and monitored |
| Emails still going to spam | Ensure all three records are set up and passing |
Related Articles
Need help setting up email authentication? Contact our support team at {{SUPPORT_URL}} or email {{SUPPORT_EMAIL}}. We can configure SPF, DKIM, and DMARC for your domain.