Email errors
DKIM fail: what dkim=fail means and how to fix it
DKIM fail means the receiver could not verify your signature. Read dkim=fail in your headers, find the cause of the DKIM failure and fix it.
What this means
DKIM fail means a receiving server found a DKIM signature on your message and could not verify it. DKIM signs each message with a private key, and the receiver checks the signature with the public key in your DNS.
RFC 8601 defines the results shown as dkim= in the Authentication-Results header:
fail: the signature was checked and failed verification.neutral: the signature had syntax errors or could not be processed.permerrorandtemperror: an unrecoverable or a likely temporary error stopped the check.none: the message was not signed. Start with DKIM setup.
DMARC, the policy check built on SPF and DKIM, only counts a signature that validates. One valid signature aligned with your From domain is enough, even if another fails.
When a DMARC report says DKIM failed
In aggregate reports, auth_results holds the plain verification result. The dkim value in policy_evaluated is the alignment test. A fail there beside pass in auth_results means a valid signature whose domain does not align with your From domain. Have the service sign with your domain.
Why it happens
A DKIM failure on every message points to the key or the signer. On one path, it points to a system that changed the message.
- Wrong or missing key. Microsoft names a DNS key that does not match the private key, or a missing key record.
- Changed message.
body hash did not verifymeans the body changed and has its own fix.signature did not verifymeans theb=signature failed against the headers inh=and the public key. Mailing lists, transport rules and gateways can change a message after signing. - Damaged key record. Google warns that a 2048-bit key does not fit in one 255-character TXT string and can end up truncated. An empty
p=means a revoked key. - Retired settings. Under RFC 8301,
rsa-sha1signatures and RSA keys under 1024 bits fail permanently. - Failed key lookup.
temperrormay clear on a later attempt. When key lookups time out, Microsoft points to a TXT record that is too large or an authoritative DNS server that is slow to respond.
How to fix it
-
Paste the full header of a failed message into the Email Header Analyzer.
-
Note the failed
dkim=result and its reason. From theDKIM-Signaturematching itsheader.dorheader.i, noted=(signing domain),s=(selector, which picks the key) anda=(algorithm). -
Enter
d=ands=in the DKIM Checker. Fors=s1andd=example.com, the key lives ats1._domainkey.example.com. Expect one record with ap=value. -
Compare it with the value in your sending service. If the selector is a CNAME, compare its target and leave the CNAME in place.
-
If the record is missing or differs, publish the exact value from the service. If your DNS host caps each string at 255 characters, split the value into quoted strings, in order. Keep a single TXT record per selector.
Caution: changing a key in use breaks DKIM for mail signed with it. If SPF does not pass and align with your From domain under
p=quarantineorp=reject, receivers may junk or reject that mail. Where possible, publish a new selector and confirm it resolves before the service signs with it. RFC 6376 advises keeping the old key for a reasonable interval. -
For
rsa-sha1, sign withrsa-sha256. For a short key, generate an RSA key of at least 2048 bits, as RFC 8301 advises, with the same caution. -
If DNS is correct and only one path fails, find the system rewriting the message. Stop the rewrite, or have it sign after its changes and publish its key first. If every path fails, check the signer and any shared gateway, and confirm
h=includesFrom.
Confirm the fix
- Wait for the old DNS record to expire, then send a new message along the path that failed, to a mailbox you control.
- Look for
dkim=passwith your domain inheader.dorheader.i. For DMARC, it must also align with your From domain. - In your next DMARC aggregate reports,
dkimshould readpassin bothauth_resultsandpolicy_evaluatedfor the source you fixed.