SPF, DKIM and DMARC Explained: Email Authentication Made Simple
Quick answer
SPF, DKIM and DMARC are DNS records that prove email from your domain is genuine. SPF lists which servers may send it, DKIM adds a digital signature to each message, and DMARC tells receiving servers what to do when a message fails those checks. Together they improve deliverability and help stop others spoofing your domain.
Why email authentication matters
Email was designed without a built-in way to check who really sent a message. Anyone can put your domain in the From line. SPF, DKIM and DMARC close that gap using records you publish in DNS.
Without them, your genuine emails, such as invoices, password resets and newsletters, are more likely to land in spam or be rejected. And scammers find it easier to send phishing email that looks like it came from you.
The three at a glance
| SPF | DKIM | DMARC | |
|---|---|---|---|
| What it checks | Was this sent from an approved server? | Was this message signed by the domain and left unaltered? | Do SPF or DKIM pass and match the From domain? |
| Record type | TXT at your domain | TXT (or CNAME) at selector._domainkey | TXT at _dmarc |
| Who creates the values | You, using your providers’ details | Your email provider generates the key | You choose the policy |
| Example | v=spf1 include:_spf.google.com ~all | v=DKIM1; k=rsa; p=MIGf… | v=DMARC1; p=none; rua=mailto:[email protected] |
SPF: who is allowed to send
SPF (Sender Policy Framework) is a TXT record listing the servers and services allowed to send email for your domain. Receiving servers compare the sending server against your list.
A typical SPF record:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
v=spf1marks it as an SPF record.- Each
include:adds a provider’s approved servers. Your email, newsletter and invoicing tools each give you their own. ~all(soft fail) says mail from anywhere else is suspicious;-all(fail) says it should be rejected.
Key rules:
- Publish only one SPF record per domain.
- SPF allows at most 10 DNS lookups while checking. Each
include:uses at least one, so long lists can break. - SPF checks the hidden “envelope” sender, not the visible From address. That’s one reason DMARC is needed.
DKIM: a signature on every message
DKIM (DomainKeys Identified Mail) adds a cryptographic signature to each outgoing message. Your provider keeps a private key and you publish the matching public key in DNS. Receivers use it to check the message really came from your domain’s sender and wasn’t altered in transit.
DKIM records live at a name containing a selector, chosen by your provider:
google._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."
Some providers ask you to add CNAME records instead, so they can rotate keys for you. Each service that sends as your domain should have its own DKIM set up, and many need you to switch signing on in their dashboard after adding the record.
DMARC: the policy that ties it together
DMARC checks that SPF or DKIM passes and that the passing domain matches (aligns with) the domain in the visible From address. It then tells receivers what to do with mail that fails, and where to send reports.
_dmarc.example.com TXT "v=DMARC1; p=none; rua=mailto:[email protected]"
| Policy | What receivers are asked to do |
|---|---|
| p=none | Deliver normally; just send reports |
| p=quarantine | Treat failing mail as suspicious, usually spam folder |
| p=reject | Refuse failing mail |
The rua address receives aggregate reports, usually daily XML files from large mailbox providers, showing which servers sent mail as your domain and whether it passed. Free and paid tools can turn these into readable summaries.
How to set up SPF, DKIM and DMARC
- List every service that sends email as your domain: your mailbox provider, newsletter platform, online store, help desk, invoicing and CRM tools.
- Create one SPF record combining the
include:values from each provider’s documentation, ending in~all. Add it as a TXT record on@. - Set up DKIM for each sender. Copy the record from each provider’s dashboard into your DNS, then switch on signing in that dashboard.
- Add a DMARC record at
_dmarcwithp=noneand aruaaddress you check. - Read the reports for a few weeks. Look for legitimate services that fail and fix their SPF or DKIM.
- Tighten the policy to
p=quarantine, thenp=rejectonce you’re confident everything legitimate passes.
Add these records wherever your DNS is managed, which is the provider your nameservers point to. If you’re setting up email from scratch, start with how to set up business email and your MX records.
Do mailbox providers require this?
Increasingly, yes. Google and Yahoo announced requirements, starting in 2024, that bulk senders authenticate with SPF and DKIM and publish a DMARC policy; Google’s guidelines also ask all senders to set up SPF or DKIM. Requirements change, so check each provider’s current sender guidelines.
Common mistakes
- Two SPF records after adding a new tool. Merge them into one.
- Too many lookups in SPF. Remove services you no longer use.
- Jumping straight to p=reject before checking reports, which can block your own invoices or newsletters.
- Forgetting DKIM on third-party tools, so their mail fails DMARC alignment.
- Records at the wrong provider after a nameserver change.
Frequently asked questions
Do I need all three?
Yes, ideally. They work as a set, and large mailbox providers such as Gmail and Yahoo require SPF, DKIM and DMARC for senders of high volumes of email. Even small senders get better deliverability with all three.
Can I have more than one SPF record?
No. A domain should have exactly one SPF record. Multiple SPF records cause SPF to fail. Combine all your senders into one record with several include: entries.
Will setting up DMARC block my own email?
Not if you start with p=none, which only monitors. Move to quarantine or reject only after reports show your legitimate senders pass.
Are these needed if my domain doesn't send email?
It's still a good idea. An SPF record of v=spf1 -all and a DMARC policy of p=reject tell receivers to reject any mail claiming to be from your domain.
Sources