SaferComputing.com

Reference · Websites

SPF, DKIM and DMARC: check the records that tell receivers who may send as your domain

Check a domain's SPF, DKIM and DMARC records with dig, Resolve-DnsName or nslookup: one v=spf1 record within 10 DNS lookups, DKIM selectors for Microsoft 365 and Google Workspace, a _dmarc policy that moves from p=none to reject, and three records for domains that send no mail.

Published
Last checked
Applies to
Any domain you own, whether it sends mail or not; Microsoft 365 and Google Workspace senders; mail to Gmail, Yahoo and Outlook.com
Technical specification
Target artifactThe DNS records that tell receiving mail servers who may send as a domain: the v=spf1 TXT record on the domain, DKIM keys at SELECTOR._domainkey, the v=DMARC1 TXT record at _dmarc, and the MX records.
Default behaviourNone of these records exists until you publish it. Without a _dmarc record the domain asks receivers for nothing, and Microsoft 365 does not DKIM-sign mail from a custom domain until its two CNAME records are published and signing is turned on.
Safe stateOne v=spf1 record that lists every sender, ends in -all or ~all and needs 10 DNS lookups or fewer; DKIM on for every service that sends as the domain; _dmarc at p=quarantine or p=reject with a rua address someone reads; a domain that sends no mail has v=spf1 -all, v=DMARC1; p=reject; and a null MX.
Check on Linuxdig +short TXT example.com
Check on Linuxdig +short TXT _dmarc.example.com
Check on WindowsResolve-DnsName -Name _dmarc.example.com -Type TXT
Check on Windowsnslookup -type=TXT _dmarc.example.com
Check in Microsoft 365Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
Check in Gmailopen a message the domain sent, More, Show original, and read the Authentication-Results header
Fix at your DNS hostmerge every v=spf1 record into one, publish each sender's DKIM record, then add _dmarc at p=none with a rua address and raise it to quarantine, then reject
Fix in Microsoft 365Set-DkimSigningConfig -Identity example.com -Enabled $true, after the two DKIM CNAME records are published
Fix for a domain that sends no mailTXT v=spf1 -all on the domain, TXT v=DMARC1; p=reject; at _dmarc, and MX 0 .

Read the records

Replace example.com with your domain. On Ubuntu, dig is in the bind9-dnsutils package.

Linux terminal
dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short MX example.com
dig +short TXT google._domainkey.example.com
dig +short CNAME selector1._domainkey.example.com
dig +short printsMeaning
A quoted line starting "v=spf1The SPF record; two such lines are an error
A quoted line starting "v=DMARC1; p=The DMARC policy
Several quoted parts on one line, "v=DKIM1; k=rsa; p=MIIB..." "..."One long record in strings of up to 255 characters, joined without spaces
0 .A null MX: the domain accepts no mail
NothingNo record of that type at that name

These formats come from dig 9.18.39 on Ubuntu 24.04, run on 9 November 2026 against a local test server. On Windows, Resolve-DnsName -Name example.com -Type TXT in PowerShell does the same, with -Type CNAME or -Type MX for the other records; in Command Prompt, use nslookup -type=TXT example.com.

SPF: one record, ten lookups

SPF (Sender Policy Framework, RFC 7208) lists the servers allowed to send for the domain. Receivers check it against the envelope sender, the MAIL FROM address that bounces go to, not the From: address people see; DMARC ties the result to the From: address.

  • One record. With two v=spf1 records the check returns permerror. Merge them: v=spf1 include:spf.protection.outlook.com include:_spf.google.com -all lists both Microsoft 365 and Google Workspace.
  • Ten lookups. include, a, mx, ptr, exists and redirect count, including those inside included records; ip4 and ip6 do not. Past 10 the check returns permerror, and Microsoft notes that fewer than 10 include terms do not guarantee fewer than 10 lookups.
  • The ending. -all gives a fail, "an explicit statement that the client is not authorized"; ~all gives a softfail, on which alone receivers should not reject mail. Microsoft's record for Microsoft 365 is v=spf1 include:spf.protection.outlook.com -all: it recommends -all with DKIM and DMARC, because its DMARC handling effectively ignores ~all failures on messages without a DKIM signature. Google's record for Google Workspace is v=spf1 include:_spf.google.com ~all, and Google recommends ~all.

DKIM: the selector records

DKIM (DomainKeys Identified Mail, RFC 6376) signs each message. The DKIM-Signature header names the domain in d= and the selector in s=, and receivers fetch the public key from SELECTOR._domainkey.DOMAIN. A key record starts with v=DKIM1; an empty p= means the key was revoked. Each service picks its own selectors: read s= in a message it sent.

Microsoft 365

selector1._domainkey and selector2._domainkey are CNAME records pointing at keys Microsoft holds and rotates. Microsoft's page, updated 3 July 2026, gives two formats for their targets, which cannot be mixed for one selector:

  • Custom domains added from May 2025: selector1-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft, where Microsoft assigns the letter before -v1.
  • Custom domains added earlier: selector1-contoso-com._domainkey.contoso.onmicrosoft.com.

Copy the exact values for your domain from Get-DkimSigningConfig. Microsoft's order: if the domain is not listed, create it with New-DkimSigningConfig -DomainName example.com -Enabled $false and list again; publish the two CNAME records; then turn signing on:

Windows PowerShell, connected with Connect-ExchangeOnline
Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
Set-DkimSigningConfig -Identity example.com -Enabled $true

Status reads NoDKIMKeys or CnameMissing until the records are found, then Valid. Keys are 1024 bits by default; Rotate-DkimSigningConfig -Identity example.com -KeySize 2048 moves to 2048 bits at the next rotation, which takes four days.

Google Workspace

In the Admin console, go to Apps, Google Workspace, Gmail, Authenticate email, choose the domain and click Generate New Record. Publish the TXT record at google._domainkey (the default selector is google), then click Start authentication. Google recommends a 2048-bit key where the DNS host accepts one, which dig shows as several quoted parts, and says DKIM can take up to 48 hours to start working.

DMARC: the _dmarc record

DMARC (RFC 9989) protects the From: address. A message passes when SPF or DKIM passes for a domain aligned with it: the same organizational domain in the default relaxed mode, or the identical domain with aspf=s or adkim=s.

p=RFC 9989's meaning
none"no expression of preference"; with a rua address, monitoring mode
quarantineFailing mail is "suspicious"
rejectFailures are "a clear indication that the use of the domain name is not valid"
TXT record at _dmarc.example.com, first stage
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
  1. Set up SPF and DKIM first; Google says to wait 48 hours before adding DMARC.
  2. Start at p=none. rua asks receivers for aggregate reports (RFC 9990); Google warns they can arrive in high volume.
  3. When the reports show only your own services, move to p=quarantine, then p=reject. Microsoft's goal is p=reject on every custom domain and subdomain, with the main domain last.
  • Subdomains follow the main domain's policy unless sp= (existing subdomains), np= (subdomains that do not exist) or a record of their own says otherwise.
  • Microsoft's and Google's example records still include pct=, from RFC 7489. RFC 9989 removed it; t=y asks receivers to apply one level less.
  • Receivers decide: RFC 9989 says they "SHOULD NOT reject messages solely because of a published policy" of reject. Microsoft 365, with Honor DMARC record policy when the message is detected as spoof on, puts quarantine failures in Junk Email and rejects reject failures with 550 5.7.1.

What Gmail, Yahoo and Outlook.com require

Provider and sendersRequirementsSince
Gmail, all sendersSPF or DKIM; spam rate below 0.3%1 February 2024
Gmail, senders of close to 5,000 or more messages to personal Gmail accounts in 24 hours, permanently once reachedSPF and DKIM; DMARC at p=none or stricter; From: aligned with SPF or DKIM; one-click unsubscribeFebruary 2024; from November 2025 Google is "ramping up its enforcement", with rejections
Yahoo, all sendersSPF or DKIM; spam rate below 0.3%February 2024
Yahoo, bulk senders; Yahoo gives no volume thresholdSPF and DKIM; DMARC at p=none or stricter, and passingFebruary 2024
Outlook.com, hotmail.com and live.com, domains sending more than 5,000 messages a daySPF and DKIM pass; DMARC at p=none or stricter, aligned with SPF or DKIM5 May 2025; failures are rejected with 550; 5.7.515 Access denied

Google says its requirements apply only to mail sent to personal Gmail accounts.

Domains that send no mail

A domain that never sends mail can still be forged. Publish three records:

TypeNameValue
TXTThe domainv=spf1 -all
TXT_dmarcv=DMARC1; p=reject;
MXThe domainPreference 0, mail server .
  • RFC 7208 gives v=spf1 -all as the record for a domain that sends no mail, and Microsoft gives both TXT records for parked domains. Microsoft also says not to publish DKIM records for them, so no forged signature can validate.
  • The null MX (RFC 7505) makes delivery to the domain "fail immediately" and must be its only MX record; receivers may refuse mail from its addresses with 550 5.7.27. dig +short MX then prints 0 ..

DMARCbis is RFC 9989

The IETF published DMARC's revision, known as DMARCbis, in May 2026 as RFC 9989, a Proposed Standard that obsoletes RFC 7489 and RFC 9091. Reports moved to RFC 9990 (aggregate) and RFC 9991 (failure). The version tag stays v=DMARC1. Compared with RFC 7489, the pct, rf and ri tags are gone and t, np and psd are new, and receivers find the organizational domain by walking up the DNS tree, at most eight queries, instead of using a public suffix list.

Sources