SPF, DKIM and DMARC are three DNS records that let mail servers check that an email really comes from your domain. SPF says which servers may send for you, DKIM adds a cryptographic signature the receiver can verify, and DMARC ties both to the From address people see and tells receivers what to do when checks fail. Publish SPF and DKIM first, then DMARC.
Each has its own detailed guide: SPF record, DKIM setup and DMARC setup. This page is the overview.
Why you need all three
Mail has two sender addresses. The envelope sender (MAIL FROM, shown later as Return-Path) is used between servers and receives bounces. The From header is what the reader sees. SPF checks the first, DKIM checks whichever domain signed the message, and neither on its own checks the From address. DMARC closes that gap.
Mailbox providers now require them:
| Provider | All senders | Bulk / high-volume senders |
|---|---|---|
| Gmail | SPF or DKIM | SPF and DKIM, DMARC (p=none allowed), alignment (Google) |
| Yahoo | SPF or DKIM | SPF and DKIM, DMARC at least p=none (Yahoo) |
| Outlook.com | Not stated | SPF and DKIM pass, DMARC at least p=none, from May 2025 (Microsoft) |
How the three work together: one message, step by step
Say your app sends a receipt from receipts@acme.com through an email service that uses send.acme.com as the return-path. When it arrives at Gmail:
- SPF. Gmail looks up the SPF record for
send.acme.com(the envelope domain) and checks that the connecting IP is listed. Pass. - DKIM. Gmail reads the
DKIM-Signatureheader, seesd=acme.com; s=s1, fetches the key ats1._domainkey.acme.comand verifies the signature. Pass. - DMARC. Gmail fetches
_dmarc.acme.com. The From domain isacme.com. DKIM passed foracme.com(exact match) and SPF passed forsend.acme.com(same organizational domain, so it aligns under relaxed mode). Pass.
If either aligned check passes, DMARC passes. Having both gives you a backup: forwarding often breaks SPF, while DKIM usually survives it.
Step 1: list everything that sends as your domain
Before touching DNS, write down every service that sends mail with your domain in the From address: your mailbox provider, your app’s email API, your newsletter tool, CRM, helpdesk, billing system, website forms. Each one needs SPF coverage or a return-path of its own, and its own DKIM records.
Step 2: SPF
SPF is a single TXT record on the domain used in the envelope sender (RFC 7208):
acme.com. TXT "v=spf1 include:_spf.google.com ~all"
The rules that trip people up:
- One record only. Two
v=spf1records cause a permerror. - 10 DNS lookups maximum.
include,a,mx,ptr,existsandredirectall count, including nested ones (section 4.6.4). - End with
~allor-all.~allis softfail,-allis fail.
Many email services avoid touching your main record at all by using their own return-path subdomain, such as send.acme.com, with its own SPF record. The SPF guide covers syntax and examples.
Step 3: DKIM
DKIM signs each message with a private key. The receiver fetches the public key from DNS at selector._domainkey.yourdomain and checks the signature (RFC 6376).
s1._domainkey.acme.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."
Your email service generates the key and gives you the record, either as a TXT with the key or as a CNAME pointing to a key it hosts and rotates. Use 2048-bit keys where you can: RFC 8301 requires at least 1024 bits and recommends 2048. The DKIM guide covers selectors and key rotation.
Step 4: DMARC
DMARC is a TXT record at _dmarc.yourdomain (RFC 9989, which replaced RFC 7489 in May 2026):
_dmarc.acme.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc@acme.com"
A message passes DMARC if SPF or DKIM passes and the passing domain aligns with the From domain. With the default relaxed alignment, send.acme.com aligns with acme.com; with strict alignment it does not.
Start at p=none to collect reports without affecting delivery. Read the aggregate reports for a few weeks, fix any legitimate source that fails, then move to p=quarantine and finally p=reject. The DMARC guide covers every tag.
Step 5: check your work
Query the records directly:
dig +short TXT acme.com
dig +short TXT s1._domainkey.acme.com
dig +short TXT _dmarc.acme.com
If a command prints nothing, the record is missing or still propagating. Then send a test message to a Gmail address, open it and choose Show original. You want SPF, DKIM and DMARC all to say PASS, with your domain next to DKIM.
Common setup mistakes
| Symptom | Cause | Fix |
|---|---|---|
spf=permerror |
Two SPF records or over 10 lookups | Merge into one record, remove unused includes |
dkim=pass but dmarc=fail |
DKIM signed with the vendor’s domain | Add the vendor’s custom DKIM records |
spf=pass but dmarc=fail |
Envelope sender is the vendor’s domain | Set up a custom return-path on your subdomain |
| Record not found | Host field entered as _dmarc.acme.com and the panel appended the domain again |
Enter _dmarc only |
How Mailcandor handles it
When you add a domain, Mailcandor gives you three DKIM CNAME records plus an SPF record and bounce MX on send.yourdomain. That return-path is aligned with your domain under relaxed DMARC, and it does not touch your main SPF record. We also suggest a DMARC record. The DNS checks confirm each record is live, and our free tools check any domain’s SPF, DKIM and DMARC.