gotinfo.net by VARØ Industries

SPF, DKIM and DMARC: How to Check and Fix a Domain's Email Security

GotInfo guides  |  VARØ Industries

Email was designed without any way to prove who sent a message. Anyone can put your domain in the From line. SPF, DKIM and DMARC are three DNS records that let receiving servers check whether a message claiming to be from your domain really is, and decide what to do when it is not.

Why all three are needed

Each record checks something different, and each has a gap that the others cover.

RecordWhere it livesWhat it checksIts gap on its own
SPFTXT on the domain itselfWhether the sending server's IP address is allowed to send for the envelope sender domainChecks the hidden envelope address (Return-Path), not the From address people see. Breaks when mail is forwarded.
DKIMTXT at selector._domainkey.domainA cryptographic signature over the message headers and bodyThe signing domain does not have to match the visible From address.
DMARCTXT at _dmarc.domainThat SPF or DKIM passed and the passing domain matches the visible From domain; then applies your policyDepends on at least one of the other two being set up correctly.

The matching requirement is called alignment, and it is what turns two technical checks into protection for the address a person actually reads.

Reading an SPF record

An SPF record is a TXT record starting with v=spf1. For example:

v=spf1 ip4:198.51.100.25 include:_spf.mail-provider.example mx -all

The two SPF mistakes that break everything

  1. More than one SPF record. A domain must have exactly one TXT record starting with v=spf1. When a second service tells you to "add this SPF record", merge its include: into your existing one instead. Two records produce a permanent error, and receivers treat SPF as failed.
  2. Too many DNS lookups. The SPF standard (RFC 7208) limits evaluation to 10 DNS lookups. Each include, a, mx and redirect counts, and so do the includes inside included records. A domain that uses an office suite, a CRM, a help desk and two marketing tools can pass the limit without anyone noticing, and the result is again a permanent error. Remove services you no longer use, and prefer a provider's single include over listing several of theirs.

Reading DKIM

With DKIM, the sending server signs each message with a private key and adds a DKIM-Signature header. The header names a domain (d=example.com) and a selector (s=s1). The receiver fetches the public key from s1._domainkey.example.com and checks the signature. Any change to the signed parts of the message in transit makes it fail.

Selectors let one domain have several keys at once, one per sending service, and they make key rotation possible: publish a new selector, switch signing to it, then remove the old one. Because selector names are chosen by each provider, nobody can list all of a domain's DKIM keys from DNS alone. The domain lookup checks common selector names, so "not found" there means only that no common selector was found. The reliable way to find a selector is to open the full headers of a real message from the domain and read the s= value.

Every service that sends mail as your domain, including newsletters, invoicing and support systems, should sign with your domain rather than its own. Most providers give you one or more CNAME or TXT records to publish for this.

Reading DMARC

A DMARC record is a TXT record at _dmarc.example.com. A typical starting record looks like this:

v=DMARC1; p=none; rua=mailto:[email protected]

A p=none policy protects nothing by itself. It is a monitoring mode, and it is where every domain should start, but the goal is to move beyond it.

A safe order for moving to enforcement

  1. Inventory senders. List every system that sends mail with your domain in the From line: your mailbox provider, website contact forms, billing, marketing and support tools.
  2. Publish SPF covering them, within the 10-lookup limit, ending in ~all while you are still discovering senders.
  3. Turn on DKIM signing with your domain for each sender.
  4. Publish DMARC with p=none and a reporting address. Read the aggregate reports for two to four weeks. A report-processing service makes the XML far easier to read.
  5. Fix what the reports show. Any legitimate source that fails needs SPF or DKIM aligned before you go further.
  6. Move to p=quarantine, optionally with a low pct at first, and keep watching.
  7. Move to p=reject once reports show only illegitimate mail failing. Tighten SPF to -all at the same time if you like.

Large mailbox providers have tightened their requirements in recent years. Gmail and Yahoo, for example, began requiring bulk senders to authenticate with SPF and DKIM and to publish a DMARC record in 2024. Even small senders see better delivery with all three in place.

Domains that never send mail

Parked domains and domains used only for a website are easy targets for spoofing because nobody watches them. Lock them down with three records:

Checking a domain

The Email Security panel on the GotInfo domain lookup reads the SPF, DMARC and common DKIM records for any domain. Use it to check your own domains after a change, or to see whether a sender you received suspicious mail from has a policy that should have stopped it. For a single message, the Authentication-Results header your mail provider adds shows exactly which checks passed and failed. The DNS record types guide covers the other records that affect delivery, such as MX and PTR.

Check SPF, DKIM and DMARC for any domain: open the GotInfo domain lookup.

Related guides