Guide

SPF, DKIM and DMARC Explained With Examples

Last updated: 30 November 2026

SPF, DKIM and DMARC are DNS records that help receivers decide whether a message really comes from your domain. They make forgery harder and help your real mail get accepted. They do not encrypt mail or guarantee it reaches the inbox.

Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works

What each one checks

NameQuestion it answers
SPFIs this server allowed to send for the domain used in the delivery envelope?
DKIMDoes the message carry a valid signature from a domain, and are the signed parts unchanged?
DMARCDoes SPF or DKIM pass for a domain that matches the visible From address, and what should happen if not?

The match in the last row is called alignment, and it is the detail people miss. A newsletter tool can pass SPF and DKIM for its own domain while your DMARC check still fails, because neither matches your From address. The fix is usually to set up the tool's custom DKIM for your domain.

Before changing anything, list every system that sends as you: your mail provider, website forms, billing software, newsletter and monitoring tools.

SPF

SPF is a TXT record on the domain itself:

example.com.  TXT  "v=spf1 mx ip4:203.0.113.10 include:_spf.mailprovider.example -all"

SPF can fail when mail is forwarded, because the forwarding server is not on your list. This is why DKIM matters.

DKIM

Your mail server or provider signs each message with a private key. The public key sits in DNS under a name chosen by a selector:

s2026._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."

The p value above is shortened; paste the full key your system gives you. Never publish the private key.

Some mailing lists change the subject or add a footer, which can break the signature.

DMARC and a safe rollout

DMARC is a TXT record at _dmarc:

_dmarc.example.com.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@example.com"

The current standard is RFC 9989, which replaced RFC 7489. It removed the old pct tag and added t=y, a test mode flag. Older guides still mention pct. Receivers may not all have caught up.

  1. Publish p=none and read reports for several weeks.
  2. Fix every legitimate sender that fails.
  3. Move to quarantine, watch again, then consider reject.

If your users post to mailing lists, the standard says you should not publish p=reject, because list mail may be rejected.

How to test

Look up what the world sees:

dig +short TXT example.com
dig +short TXT s2026._domainkey.example.com
dig +short TXT _dmarc.example.com

Then send a message to a mailbox elsewhere. In Gmail, open it, choose the More menu, then Show original. Check for spf=pass, dkim=pass and dmarc=pass, and check which domain passed. Test every sending system separately, not only your own mail program.

Typical results and what they usually mean:

Allow for DNS caching after changes. A lower TTL set well in advance makes corrections quicker. Also check your DNS panel does not add your domain twice to a record name, which creates names such as _dmarc.example.com.example.com.

Domains that send no mail

Parked domains can be forged too. If a domain never sends or receives mail, you can say so:

parked.example.  TXT  "v=spf1 -all"
_dmarc.parked.example.  TXT  "v=DMARC1; p=reject"
parked.example.  MX  0 .

The last line is a "null MX". It means the domain accepts no mail, so remove other MX records first, and never use it on a domain that appears in your sender addresses.

If you run your sending server on a VPS, you also need correct reverse DNS and an open port 25. Ask support before ordering; our test IPs page lets you check reachability.

Questions and answers

Do I need all three?
It is the sensible setup. Requirements differ by receiver and by sending volume, and large providers ask bulk senders for all three.

Does DMARC stop all phishing in my name?
No. It addresses forgery of your exact domain. It does not stop lookalike domains or fake display names.

Why does DMARC pass when SPF fails?
Only one of SPF or DKIM needs to pass with alignment. This is common with forwarded mail, where the DKIM signature survives.

Can I jump straight to p=reject?
For a domain that sends nothing, yes. For a domain in use, start with p=none or you may block your own legitimate mail.

Related guides

Ready to try it? Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works