SPF, DKIM and DMARC explained: stop spoofing and reach the inbox
Last checked: Oct 20, 2026
Anyone can put your domain in the From line of an e-mail. SPF, DKIM and DMARC are three DNS records that let receiving servers check whether a message really comes from you. Since 2024, Gmail and Yahoo reject or spam-folder mail that does not pass them.
In short
- SPF lists the servers allowed to send mail for your domain.
- DKIM signs every message; the public key for checking it is published in DNS.
- DMARC tells receivers what to do when SPF and DKIM fail and sends you reports. It only passes when the domain in the visible From address matches.
- Start with
p=none, read the reports, then move toquarantineandrejectonce every legitimate sender passes.
The three records at a glance
| Record | Where | Example |
|---|---|---|
| SPF | TXT on the domain itself | v=spf1 include:_spf.google.com ~all |
| DKIM | TXT (or CNAME) on selector._domainkey.example.com | v=DKIM1; k=rsa; p=MIIBIjANBg… |
| DMARC | TXT on _dmarc.example.com | v=DMARC1; p=none; rua=mailto:[email protected] |
Why it matters now
Since February 2024 Gmail and Yahoo require SPF or DKIM from every sender. Bulk senders (Google counts more than 5,000 messages a day to Gmail addresses) need SPF, DKIM and a DMARC record (p=none is enough), a From domain aligned with SPF or DKIM, one-click unsubscribe for marketing mail and a spam complaint rate below 0.3%.
Even if you send little mail, missing records make your domain easy to spoof in phishing, and receivers trust mail from such domains less.
SPF
SPF is a single TXT record on your domain that starts with v=spf1, lists the allowed senders and ends with a rule for everyone else. include: pulls in a provider's list, ip4:/ip6: add your own servers and mx allows the domain's MX hosts.
- Publish exactly one SPF record. Two
v=spf1records make SPF fail (permerror); merge them into one. - SPF may use at most 10 DNS lookups (every include, a, mx, exists and redirect counts, nested ones too). Above that SPF fails; remove includes you no longer use.
-all(fail) asks receivers to reject unlisted senders,~all(softfail) to treat them as suspicious. With DMARC in place,~allis common and safe.- SPF checks the envelope sender (Return-Path), not the From address people see, and it breaks when mail is forwarded. That is why you need DKIM too.
DKIM
The sending server signs the headers and body with a private key; the receiver fetches the public key from selector._domainkey.example.com and verifies the signature. The selector is a name chosen by your provider (google, selector1, s1, k1…), so every service you send through gets its own key.
Turn DKIM on in every service you send with (mailbox provider, newsletter tool, CRM, online shop) and publish the record it gives you, usually a TXT or CNAME. Use 2048-bit keys where offered. DKIM survives forwarding, which makes it the more reliable half for DMARC.
DMARC
DMARC lives at _dmarc.example.com. A message passes DMARC when SPF or DKIM passes and the domain it passed for matches (aligns with) the domain in the From address. A provider that signs with its own domain does not help until you set up DKIM for yours.
rua=mailto: asks receivers to send daily aggregate reports (XML) listing which servers sent mail as your domain and whether they passed. These reports are how you find forgotten senders before you tighten the policy.
| Policy | What happens to failing mail |
|---|---|
p=none | Delivered as usual; you only get reports. The starting point. |
p=quarantine | Put in the spam folder. |
p=reject | Refused during delivery. Full protection against spoofing. |
A safe rollout
- List everything that sends mail as your domain: mailboxes, website forms, newsletter, invoicing, support desk.
- Publish one SPF record that covers them all and enable DKIM in each of them.
- Add
v=DMARC1; p=none; rua=mailto:…and read the reports for two to four weeks. - Fix every legitimate sender that fails, then switch to
p=quarantine(gradually withpct=if you like) and later top=reject. - Domains that never send mail should publish
v=spf1 -allandv=DMARC1; p=rejectso nobody can spoof them.
Beyond the basics
- MTA-STS and TLS-RPT make other servers deliver to you only over verified TLS and report problems.
- BIMI shows your logo next to your messages in supporting inboxes; it requires DMARC at quarantine or reject.
Check your domain
The E-mail security check reads MX, SPF (with its DNS lookup count), DKIM for common selectors or your own, DMARC, MTA-STS, TLS-RPT and BIMI, and points out the problems it finds. Run it again after every DNS change; depending on the TTL, new records can take from a few minutes to an hour to appear.
Sources
- RFC 7208 – SPF
- RFC 6376 – DKIM
- RFC 7489 – DMARC
- Google – Email sender guidelines
- Yahoo – Sender best practices
This guide summarizes public information and is not legal advice. Rules can change; the official texts and announcements prevail.
Other guides
- Domain transfer: moving a domain to another registrar, step by step
- SSL certificate errors: what they mean and how to fix them
- DNS records explained: A, AAAA, CNAME, MX, TXT, NS and more
- How to choose a domain name: a practical checklist
- Who owns a domain? WHOIS and RDAP lookups explained
- Accredited .tr registrars and how to choose one
- The example.tr guide: domains directly under .tr (a.tr)
- The .tr domain guide: TRABİS, .com.tr and the rules