Blog

SPF, DKIM and DMARC explained, with the records to publish

2026-11-16 · 6 min read

Mail servers do not trust a message just because it says it is from you. SPF, DKIM and DMARC are three DNS-based checks that let a receiving server decide whether a message really came from your domain.

SPF: which servers may send for your domain

SPF is a TXT record on your domain that lists the servers allowed to send mail for it. The receiving server looks at the address the message came from, fetches the record, and checks whether the sending server is on the list.

A domain may have only one SPF record. If you use several services, they go into the same record.

yourdomain.com.  TXT  "v=spf1 include:_spf.your-sender.example -all"

DKIM: a signature on the message

With DKIM your sending service signs each message with a private key. You publish the matching public key in DNS under a name called a selector. The receiver checks the signature against that key. If the message was changed on the way, the check fails.

selector1._domainkey.yourdomain.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."

DMARC: what to do when the checks fail

DMARC ties the two together. It passes only when SPF or DKIM passes and the domain in the passing check matches the domain in the visible From address (this is called alignment). The record also tells receivers what to do with mail that fails, and where to send reports.

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

A safe order to roll them out

  • Publish SPF and DKIM for every service that sends as your domain.
  • Start DMARC with p=none and read the reports for a few weeks, so you find senders you forgot.
  • Move to p=quarantine, then p=reject, once the reports show only mail you recognise.

Common mistakes

  • Two SPF records on one domain. Receivers treat this as an error, so merge them into one.
  • More than ten DNS lookups in SPF. Each include counts, and past ten the record fails.
  • Signing with a different domain than the From address, so DMARC alignment fails even though DKIM passes.

Next step

Check your domain's records

Or see Meghly Send, which sends, validates and routes mail from one dashboard.