DNS

Email Authentication for Your Domain: SPF, DKIM and DMARC

What SPF, DKIM and DMARC records do, where they live in DNS, and what to copy before you change nameservers.

Autobaselli · 2 min read

Email was designed without a strong way to prove who sent a message. Three DNS-based standards help receiving mail servers check that a message really comes from a domain's owner. If you run a website on your own domain and send email from it, you will meet all three.

SPF: which servers may send

Sender Policy Framework lets a domain owner list the hosts that are allowed to send mail using the domain's name. A receiving server can then check the sending host against that list (RFC 7208). The list is published in your DNS as a TXT record at the domain. A typical value starts with v=spf1 and then names the allowed senders. Your email provider documents the exact value to use.

DKIM: a signature on each message

DomainKeys Identified Mail attaches a cryptographic signature to a message. The signing domain publishes the matching public key in DNS, and the receiving server fetches it to check the signature (RFC 6376). The key is stored under a "selector" name followed by _domainkey, for example selector1._domainkey.example.com. Your email provider generates the key and tells you which record to add.

DMARC: what to do when checks fail

Domain-based Message Authentication, Reporting and Conformance lets a domain owner say how receivers should treat mail that fails the checks, and ask for reports (RFC 7489). The policy is a TXT record at the name _dmarc under your domain. Its p= tag sets the policy: none (take no action, only report), quarantine or reject. Receivers decide how to act, so a policy is a request, not a guarantee.

How the three fit together

Before you change DNS

These records live at your DNS provider, the same place as your website records. If you change nameservers, copy these records to the new provider first, or mail from your domain can stop passing checks. The DNS change check on this site lists the records to keep. See also how DNS records work.

Starting with a DMARC policy of none and reading the reports before tightening it is a common approach. That is general practice, not a rule in the standard, and your email provider's documentation comes first.

Sources