Back to Learning Center
DNS & DNSSEC

How to Audit SPF, DKIM and DMARC for a Client Domain

7 min read·Updated November 2026·By CertNotify Team

Auditing a domain's email authentication means reading three DNS TXT records: SPF at the domain, DKIM at a selector under _domainkey, and DMARC at _dmarc. Each has a specific way of failing that looks fine at a glance. This guide reads all three with one small script and says, from the RFCs, what to look for.

The lookup

This prints the TXT records at any name, using Google Public DNS's JSON API:

#!/bin/sh
# Usage: sh dns-txt.sh name
# Prints the TXT records published at a DNS name, one per line, as
# Google Public DNS returns them. Needs curl and python3.
curl -s "https://dns.google/resolve?name=$1&type=TXT" | python3 -c 'import json, sys
for a in json.load(sys.stdin).get("Answer", []):
    if a["type"] == 16:
        print(a["data"])'

SPF: who may send

sh dns-txt.sh example.com | grep '^v=spf1'
v=spf1 -all

-all with nothing before it says no server may send mail as this domain, which is right for a domain that sends none. For a domain that does send, check these:

  • Exactly one record. Two records starting v=spf1 at the same name is an error.
  • The 10-lookup limit. RFC 7208 §4.6.4 lists the terms that cause DNS queries: the include, a, mx, ptr and exists mechanisms and the redirect modifier. Implementations "MUST limit the total number of those terms to 10", and exceeding it is a permerror. Includes inside includes count too, so a record that looks short can be over. The free SPF checker counts them.
  • Every sending service listed. A newsletter or helpdesk tool sending as the domain needs its own entry.

DKIM: the signing key

A DKIM key lives at <selector>._domainkey.<domain>. RFC 6376 gives the example of a signature with d=example.com and s=foo.bar, whose key is queried at foo.bar._domainkey.example.com. There is no list of selectors to query, so find the one to check in the s= tag of the DKIM-Signature header of a message the domain actually sent.

sh dns-txt.sh s1._domainkey.example.com
v=DKIM1; p=

The p= tag holds the public key. Here it is empty, and RFC 6376 §3.6.1 is explicit: "An empty value means that this public key has been revoked." Mail signed with that selector fails DKIM. If you see this for a selector your mail still uses, signing has broken. The free DKIM checker parses the record for you.

DMARC: what receivers should do

sh dns-txt.sh _dmarc.example.com
v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s
  • Exactly one record. RFC 7489 §6.6.3: if the set "contains multiple records or no records, policy discovery terminates and DMARC processing is not applied". A second record, often left over from a previous provider, cancels the first.
  • The policy. p=none requests "no specific action be taken regarding delivery of messages"; it collects reports and blocks nothing. quarantine and reject are the enforcing values.
  • Reports. rua= says where aggregate reports go. Without it, nobody learns which mail is failing.

Doing this for many client domains

These checks are point-in-time: they tell you what is published now. The free email security checker runs SPF, DKIM, DMARC and more in one go for any domain. On paid plans, CertNotify's daily DNS check records each monitored domain's TXT and _dmarc records and alerts when they change, so a removed SPF include or a second DMARC record shows up the next day. It reports the change, not a fresh pass or fail, and it does not watch DKIM keys. See monitoring for MSPs.

Common questions

How do I check a domain's SPF record?

Look up the TXT records at the domain itself and find the one that starts with v=spf1. Count the include, a, mx, ptr and exists mechanisms and any redirect, including those inside included records: RFC 7208 caps them at 10.

Where is a DKIM key published?

At <selector>._domainkey.<domain>, as a TXT record. The selector is the s= tag in the DKIM-Signature header of a message the domain sent. An empty p= means the key has been revoked.

What happens with two DMARC records?

RFC 7489 says that if a receiver finds more than one DMARC record, policy discovery terminates and DMARC is not applied. Two records therefore behave like none.

Is p=none enough?

p=none asks receivers to take no action on failing mail; it only collects reports. It is where a rollout starts, not where it should stay once the reports show legitimate mail passing.

References and further reading

The specifications and primary documentation this article is based on.

Read next

More guides on the same subject.

Know when a client's mail records change

On paid plans, CertNotify checks every monitored domain's DNS daily, including SPF and DMARC records, and alerts you when they change.

Start 14-day Pro trial