Get the full Deliverability Preflight Card — $19 one-time
Free guide

How to check SPF, DKIM and DMARC with dig

Mail bouncing or landing in spam even though your provider's dashboard shows green ticks? These are the exact dig commands to check every part of your sending setup yourself, with what a good answer looks like. Nothing to install on macOS or Linux, and no third-party scanner.

A common and confusing failure: SPF and DKIM both "pass", but neither aligns with your From: domain, so DMARC still fails. Section D shows how to spot it in one header line.

Replace example.com with your sending domain. dig ships with macOS and most Linux distributions (bind-utils / dnsutils). On Windows, use the nslookup form or install BIND tools.

Tip: add @1.1.1.1 or @8.8.8.8 to query a public resolver directly and avoid a stale local cache, e.g. dig @1.1.1.1 +short TXT example.com.

A. SPF

CheckCommandWhat to look for
A1, A3, A6dig +short TXT example.comExactly one string starting v=spf1. Two of them is a permerror.
A2dig +short TXT _spf.provider.com (repeat for each include:)Count every include, a, mx, ptr, exists, redirect, including the ones inside each include. Total must be ≤ 10.
A4, A5same as A1Every platform that sends for you is listed; record ends in ~all or -all, never +all.

nslookup -type=TXT example.com

B. DKIM

CheckCommandWhat to look for
B1, B2dig +short TXT selector._domainkey.example.comv=DKIM1; k=rsa; p=MIIB.... If your platform uses a CNAME, run dig +short CNAME selector._domainkey.example.com and then query the target.
B3same as B1A 2048-bit RSA key has a p= value of roughly 390+ characters; 1024-bit is about 215.
B4View the headers of a real sent message ("Show original" in Gmail)DKIM-Signature: ... d=example.com matches your From: domain.

Finding the selector: open the headers of a message you sent and read s= in the DKIM-Signature line. Common selectors include google (Google Workspace), selector1/selector2 (Microsoft 365), s1/s2 (SendGrid) and k1/k2/k3 (Mailchimp); your platform's domain-authentication screen shows the exact one.

C. DMARC

CheckCommandWhat to look for
C1, C2, C3, C5dig +short TXT _dmarc.example.comOne record starting v=DMARC1, a deliberate p= (none, quarantine, reject) and a rua=mailto: address someone reads.
C3 (external rua)dig +short TXT example.com._report._dmarc.reports.vendor.comIf rua points to another domain, that domain must publish this authorization record.

D. Alignment

Open the headers of a real message (not a test from the platform UI) and read the Authentication-Results line:

E. Return-path, MX, bounces

CheckCommandWhat to look for
E1, E2dig +short CNAME bounce.example.com (or the return-path host your platform gives you)Resolves to your platform's bounce host.
E3dig +short MX example.comOnly the mail hosts you expect, with sensible priorities.

F. Dedicated IPs

CheckCommandWhat to look for
F1dig +short -x 203.0.113.10 then dig +short A <returned-hostname>The PTR hostname is under your domain and resolves back to the same IP.

G. Transport security

CheckCommandWhat to look for
G1, G2openssl s_client -starttls smtp -connect mx.example.com:25 -servername mx.example.com </dev/nullThe handshake completes and Verify return code: 0 (ok). Port 25 is often blocked on home connections; run it from a server if it hangs.
G3dig +short TXT _mta-sts.example.com and curl https://mta-sts.example.com/.well-known/mta-sts.txtv=STSv1; id=... and a policy file with mode: and max_age:.
G4dig +short TXT _smtp._tls.example.comv=TLSRPTv1; rua=mailto:...

H. Tracking domains

CheckCommandWhat to look for
H1, H3dig +short CNAME click.example.com (your tracking host)Points to your platform's tracking host, not your main website.
H2dig +short TXT click.example.comIf the subdomain also sends mail, it needs its own SPF; DKIM/DMARC as needed.

Want the full preflight?

This page is the command reference. The Deliverability Preflight Card adds the 39-check checklist with pass criteria and severity, a printable card, a red/amber/green scorecard and a fix-plan template.

Get the full Deliverability Preflight Card — $19 one-time

Free to share · cookieless, privacy-friendly analytics