DKIM body hash did not verify
Quick fix
Find the hop after signing that changes the body, then move the disclaimer, footer or link rewriting before the signing step, or have the last system that changes the message sign it with your domain.
How to fix it
- Read the
Receivedheaders from the bottom up and mark every server after the one that added yourDKIM-Signature. - Send one message from the signing service directly to an outside mailbox and one along the normal path. If only the normal path fails, the change is on that path.
- Move the disclaimer, footer or link rewriting before the signing step, or have the last system that changes the message sign it with your domain.
- For a gateway in front of Microsoft 365, configure it as a trusted ARC sealer or add it to Enhanced Filtering for Connectors.
- Sign with
c=relaxed/relaxedand withoutl=. - Keep SPF aligned as well, so direct mail still passes DMARC when a signature breaks.
Learn more: DKIM explained: selectors, keys and rotation
How to check
Take the d= and s= tags from the failing DKIM-Signature header and check that selector with the DKIM check. When the key is published and valid, the DNS side is fine and the cause is a hop in the mail path. The mail check shows whether SPF and DMARC are in place to carry direct mail when a signature breaks.
The DKIM record check opens with your domain filled in; it runs when you press Check.
Tools to check it
What the error means
dkim=fail (body hash did not verify)
The receiver found your DKIM-Signature and the key in DNS, but the body it received is not the body that was signed. RFC 6376 section 6.1.3: "If the hash does not match, the Verifier SHOULD ignore the signature and return PERMFAIL (body hash did not verify)." Microsoft shows the result in its headers as dkim=fail (body hash did not verify) header.d=contoso.com. Something between the signing server and the receiver changed the message.
The signature carries a hash of the body in its bh= tag (RFC 6376, section 3.5). Before hashing, both sides canonicalize the body as the c= tag says. RFC 6376 section 3.4 defines a "simple" algorithm "that tolerates almost no modification" and a "relaxed" algorithm "that tolerates common modifications such as whitespace replacement and header field line rewrapping". Relaxed body canonicalization ignores whitespace at the end of lines, reduces runs of spaces and tabs to one space and ignores empty lines at the end. Any other change to the body breaks the hash: added text, a rewritten link, a new transfer encoding.
The key is fetched before the body is hashed (RFC 6376, sections 6.1.2 and 6.1.3), so the DNS record is not the problem. A message with no signature at all is a different result; see DKIM signature not found.
Find the hop that changed the message
- Read the
Receivedheaders from the bottom up. Every SMTP server "MUST insert trace ("time stamp" or "Received") information at the beginning of the message content" (RFC 5321, section 4.4), so the lowest one is the first hop and the top one the last. Mark the server that added your signature (thed=domain's service): every server above it is a candidate. - Look for
Authentication-Resultsheaders added on the way. If a server in the middle recordeddkim=passand your receiver recordsdkim=fail, the change happened between those two hops. RFC 8601 (appendix B.6) shows this case: a mailing list server records a pass, adds "footer text to the body", and the final receiver reports the original signature as a "fail". Trust only headers from servers you trust; see reading the Authentication-Results header. - Our recommendation: send one message from the signing service directly to an outside mailbox, and the same message along the normal path (through your gateway, relay or list). If only the normal path fails, the change is on that path.
- Read every
dkim=result. A message can carry several signatures, and the receiver reports one result per signature with the domain inheader.dorheader.iand the selector inheader.s(RFC 8601, section 2.7.1). The RFC's own example readsdkim=pass reason="good signature" [email protected]; dkim=fail reason="bad signature" [email protected]. There, the signature that fails was added before the change, and the one that passes was added after it by the server that made the change. RFC 6376 section 4.2 tells verifiers to "evaluate signatures independently and on their own merits".
Typical culprits and the fix for each
| Culprit | What it changes | Fix |
|---|---|---|
| Microsoft 365 disclaimer (mail flow rule, also called a transport rule) | Adds text to the top or bottom of messages. Microsoft: "By default, mail flow rules are applied to incoming and outgoing messages." | Add a condition so the rule only changes outgoing mail, as Microsoft describes, and make sure the system that signs for your domain signs after the disclaimer is added. |
| Exchange Server in a hybrid setup | Microsoft: "Exchange 2016 and later are known to modify messages that flow through them, which can affect DKIM." | Our recommendation: let the last server before the internet sign, after Exchange has handled the message. |
| Security gateway in front of Microsoft 365 (Microsoft names Proofpoint and Mimecast as examples) | Microsoft: the service "modifies the message, which breaks DKIM", for example by adding a disclaimer or scan notice. | In Microsoft's order: configure the gateway as a trusted ARC sealer, add it to Enhanced Filtering for Connectors, or have it DKIM-sign with your domain after it changes the message. |
| Link rewriting | Rewrites URLs in the body. Microsoft's Safe Links provides "URL scanning and rewriting of inbound email messages during mail flow". | The same as for a gateway: ARC or a new signature after the rewrite, at the system that rewrites. |
| Mailing list footer | RFC 6377 section 3.3: lists insert "headers or footers within HTML messages. Most or all of these changes will invalidate a DKIM signature." | Only the list can fix it. RFC 6377 section 5.8: "A DKIM-aware resending MLM SHOULD sign the entire message after the message is prepared for distribution". |
| Re-encoding on the way | RFC 6376 section 5.3: "Some messages, particularly those using 8-bit characters, are subject to modification during transit, notably conversion to 7-bit form. Such conversions will break DKIM signatures." | Encode the body as quoted-printable or base64 before signing, as RFC 6376 section 5.3 says signers SHOULD. |
Whitespace changes with c=simple | The simple body algorithm tolerates almost no modification, so trailing spaces matter. | Sign with c=relaxed/relaxed where the service lets you choose. |
The l= tag as a workaround | l= signs only the first part of the body, so text appended later does not break the hash. RFC 6376 section 8.2: "using the "l=" tag enables attacks in which an intermediary with malicious intent can modify a message to include content that solely benefits the attacker." RFC 6377 section 5.1: "its use is discouraged." | Do not use l=. Fix the hop that changes the body instead. |
What it breaks
A broken signature counts as no signature. RFC 6376 section 6.1: "a Verifier SHOULD NOT treat a message that has one or more bad signatures and no good signatures differently from a message with no signature at all."
On direct mail this is often harmless. RFC 9989 section 5.3.5: "If one or more of the Authenticated Identifiers align with the Author Domain, the message is considered to pass the DMARC mechanism check." An SPF pass for a domain aligned with the From domain is enough. Microsoft's example of a gateway that breaks the body shows the other case: SPF passes for the gateway's own domain, not yours, and DMARC fails.
On forwarded mail it is fatal under p=reject. RFC 9989 section 7.4: relayed mail "will most likely fail SPF checks unless the RFC5321.MailFrom address is rewritten by the relaying MTA", while "DKIM signatures will generally remain valid in these relay situations". It goes on: "domains that publish "p=reject" MUST NOT rely solely on SPF to secure a DMARC pass and MUST apply valid DKIM signatures to their messages." A forwarded message whose body changed after signing has neither SPF nor DKIM left, and the receiver is asked to reject it. Outlook.com's rules for senders of high volume, and its rejection, are on 550 5.7.515.
Sources
- RFC 6376: DKIM Signatures, sections 3.4, 3.5, 4.2, 5.3, 6.1 and 8.2 (checked 2026-11-20)
- RFC 8601: Authentication-Results header field, section 2.7.1 and appendix B.6 (checked 2026-11-20)
- RFC 6377: DKIM and Mailing Lists, sections 3.3, 5.1 and 5.8 (checked 2026-11-20)
- RFC 9989: DMARC, sections 5.3.5 and 7.4 (checked 2026-11-20)
- RFC 5321: Simple Mail Transfer Protocol, section 4.4 (checked 2026-11-20)
- Microsoft Learn: Troubleshoot email authentication in Microsoft 365 (checked 2026-11-20)
- Microsoft Learn: Organization-wide message disclaimers, signatures, footers, or headers in Exchange Online (checked 2026-11-20)
- Microsoft Learn: Set up DKIM to sign mail from your cloud domain (checked 2026-11-20)
- Microsoft Learn: Safe Links in Microsoft Defender for Office 365 (checked 2026-11-20)