What does dkim=fail (body hash did not verify) mean?
dkim=fail (body hash did not verify) means the receiver found a DKIM signature, fetched the public key, hashed the message body and got a different value from the bh= tag in the signature. The body changed after it was signed. The key and DNS are usually fine: something between the signer and the receiver added, removed or re-encoded content.
The wording comes straight from the DKIM standard. RFC 6376 Section 6.1.3 tells a verifier that "if the hash does not match", it should ignore the signature and "return PERMFAIL (body hash did not verify)." Microsoft 365 prints the same phrase in its Authentication-Results header, and Google's Troubleshoot DKIM issues article says this result means the message was changed in transit.
For DKIM basics, start with the DKIM guide.
Key takeaways
- The body hash (
bh=) covers the canonicalised body only. Any footer, banner, rewritten link or re-encoding after signing changes it. - "Body hash did not verify" means the body changed. "Signature did not verify" means the signed headers changed or the key does not match. They have different fixes.
- Find the hop by comparing results along the path:
ARC-Authentication-Results, internal test messages, and theReceivedchain. - The durable fix is to sign last: let the gateway sign, or stop it modifying mail after signing.
relaxed/relaxedonly tolerates whitespace changes. - Do not use the
l=body length tag to work around footers. RFC 6376 Section 8.2 warns against it.
What is the DKIM body hash (bh=) and what does it cover?
The bh= tag holds a base64 hash of the message body, computed after canonicalisation. RFC 6376 Section 3.5 defines it as "the hash of the canonicalized body part of the message as limited by the "l=" tag". Headers are not in the body hash; they are covered separately by the signature in b=.
Section 3.7 describes the two-step process. First the signer (or verifier) hashes the canonicalised body and stores (or compares) the result in bh=. Then it hashes the selected headers plus the DKIM-Signature header itself, which includes bh=, and signs that. So the body hash is checked first, and a mismatch stops verification before the cryptographic signature is even tested.
A typical signature looks like this:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
s=sel1; t=1764064800; h=from:to:subject:date:message-id;
bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZVoG4ZHRNiYzR...
The c= tag shows the canonicalisation (header/body), and l=, if present, limits how many body octets were hashed. When l= is absent, the whole body is covered.
How do simple and relaxed body canonicalisation differ?
Canonicalisation decides which small changes the body hash ignores. simple ignores almost nothing; relaxed ignores whitespace differences. Neither ignores added text, changed links or a new MIME encoding, so neither will save a message that a gateway has stamped with a footer.
The rules from RFC 6376 Sections 3.4.3 and 3.4.4:
| Body canonicalisation | What it normalises | Changes that still break the hash |
|---|---|---|
simple |
Ignores empty lines at the end of the body. "It makes no other changes" | Any change at all inside the body, including trailing spaces, tabs turned into spaces, re-wrapped lines |
relaxed |
Ignores whitespace at the end of lines, reduces runs of spaces and tabs within a line to one space, ignores empty lines at the end | Added or removed text, footers, banners, rewritten URLs, changed MIME boundaries, changed transfer encoding, re-wrapped lines |
Defaults matter. RFC 6376 says that if the signer names no algorithm, simple applies to both header and body, and if c= names only one algorithm, that one is used for headers and simple for the body. A signature with no c= tag, or with c=relaxed, therefore uses simple body canonicalisation, the strictest option.
What usually causes body hash did not verify?
In practice the cause is almost always a system that touches the body after the signer is done. In rough order of how often MSP engineers run into them:
- Gateway footers and disclaimers. An outbound secure email gateway or a third-party email signature service appends a legal disclaimer or signature block after the mail platform has signed. Google's DKIM troubleshooting article names this case: some outbound gateways "add a footer to the bottom of every outgoing message", which "can cause DKIM to fail."
- Link rewriting and URL protection. Gateways that rewrite URLs for click-time scanning change every link in the body. That is harmless on inbound mail already verified at the edge, but it breaks the signature if the rewritten message is relayed or forwarded onward.
- Antivirus and external-sender banners. "This message came from outside your organisation" banners or scan stamps inserted into the body after signing.
- Mailing list footers. RFC 6376 itself notes that "it is very common for mailing lists to add trailers to messages", such as unsubscribe instructions.
- Forwarding services that re-encode MIME. A forwarder or relay converts 8-bit content to quoted-printable or base64, rebuilds MIME parts, or strips an attachment. RFC 6376 Section 5.3 tells signers to convert to 7-bit MIME before signing for exactly this reason.
- Line ending and whitespace changes. Systems that rewrap long lines, convert line endings or trim spaces.
relaxedabsorbs some whitespace edits but not rewrapping or encoding changes. Section 8.15 also notes that badly formed messages are often "silently fixed in transit", which changes what was signed. - Signing before the content was final. The sending application or ESP signs, then a later stage of its own pipeline inserts a tracking pixel, rewrites links for click tracking or changes the encoding. This one shows up on every message from that source, regardless of receiver.
A forwarding hop or mailing list you do not control falls in categories 4 and 5; the forwarding guide covers why DKIM normally survives plain forwarding and what breaks it.
How is body hash did not verify different from signature did not verify?
They are two separate checks in RFC 6376 Section 6.1.3. "Body hash did not verify" (step 3) means the canonicalised body no longer matches bh=. "Signature did not verify" (step 4) means the body hash matched, but the signature over the signed headers does not validate with the public key.
That difference tells you where to look:
| Result comment | What failed | Typical causes | Where to look |
|---|---|---|---|
body hash did not verify |
Body changed after signing | Footer, banner, link rewrite, MIME re-encoding | Hops that process content: gateways, signature services, lists, forwarders |
signature did not verify |
Signed headers changed, or the key does not match | Subject tag added by a list, a header in h= rewritten, wrong or rotated public key in DNS, broken TXT record |
Headers listed in h=, and the key at <s>._domainkey.<d> |
If you see "signature did not verify", start with the key and selector checks in how to check if DKIM is working and the selector problems in DKIM management for MSPs. A key that was rotated in the platform but not yet in DNS is a common cause.
Why do some receivers show dkim=neutral instead of dkim=fail?
RFC 8601, which defines Authentication-Results, gives receivers a set of result codes but does not tie the "body hash" case to one of them. fail means the signature "failed the verification test(s)"; neutral covers signatures that could not be processed and "other failures not covered elsewhere in this list."
Receivers choose for themselves, and the text in brackets is a human-readable comment, not a standard field. Microsoft documents dkim=fail (body hash did not verify) as an example on its anti-spam message headers page. Other receivers have been seen recording the same condition as dkim=neutral with the same comment. Google's own documentation does not specify which code Gmail uses, so treat either form as the same problem: the body changed.
What does the error look like in a message header?
Open the delivered message's full headers (in Gmail, More then Show original; in Outlook, the message properties) and find the receiver's Authentication-Results line. The email header guide explains which header belongs to which hop. An illustrative example, not copied from a real message:
Authentication-Results: mx.example.net;
dkim=fail (body hash did not verify) header.d=example.com header.s=sel1;
spf=pass (sender IP is 192.0.2.25) smtp.mailfrom=example.com;
dmarc=pass action=none header.from=example.com
Here the DKIM signature broke, but SPF passed with an aligned smtp.mailfrom, so DMARC still passed. That combination hides the problem until SPF stops aligning.
Microsoft 365 adds a useful hint in compauth. Its header documentation lists reason code 108: "DKIM failed due to a message body modification attributed to previous legitimate hops", for example a body modified in the organisation's on-premises environment.
How do you find the hop that changed the body?
Work backwards from the receiver until you find the last point where DKIM still passed. The hop after that point is the one that changed the body. Three techniques, usually in this order:
Compare ARC-Authentication-Results along the path
If any intermediary seals with ARC (RFC 8617), each seal adds an ARC-Authentication-Results header that records the authentication result "at message arrival time" at that hop. Read them in instance order:
ARC-Authentication-Results: i=1; gw.example.org;
dkim=pass header.d=example.com header.s=sel1;
spf=pass smtp.mailfrom=example.com
If i=1 shows dkim=pass and the final receiver shows body hash did not verify, the change happened at or after the i=1 sealer, before the final receiver. More on reading ARC sets in the ARC explainer.
Send test messages before and after each hop
Send the same message to an external mailbox you control in two ways: through the normal path, and through a path that skips the suspect hop (for example, a test mailbox excluded from the disclaimer rule, or a connector that bypasses the signature service). Compare the Authentication-Results lines and the raw bodies. If only the gateway path fails and its body ends with a disclaimer the other lacks, you have the answer. Keep both header sets in the ticket as evidence.
Read the Received chain
The Received headers list each server that handled the message, newest at the top. Look for hops between the signer and the receiver that belong to content-processing systems: a gateway, signature service, list server or forwarder. Compare that list with where the signer sits. If the platform that signs (the d= domain's mail system) appears below a gateway in the chain, the gateway processed the message after signing.
DMARC aggregate reports help at portfolio scale: they show that a source has DKIM failing for a domain and selector, but not why. Use them to find the affected source and IP, then use the header techniques above for the reason.
How does DMARC still pass when the body hash fails?
DMARC passes if either SPF or DKIM passes and aligns with the From domain, as RFC 9989 keeps from the original specification. A broken DKIM signature does not fail DMARC on its own if SPF passes for an aligned MAIL FROM domain.
It also passes if another aligned DKIM signature survives. A message can carry several signatures, and RFC 6376 Section 4.2 says verifiers should "evaluate signatures independently and on their own merits". If the mail platform signs as example.com and a gateway that modifies the body then adds its own example.com signature, the second signature verifies even though the first fails.
The risk is reliance on SPF alone. SPF does not survive forwarding, so mail that passes DMARC today only because of SPF can fail DMARC once it is forwarded. The SPF versus DMARC explainer and the alignment guide cover the alignment side.
How do you fix dkim body hash did not verify?
Fix the order of operations: signing has to be the last step that touches the body. The table below maps each cause to where you see it and what to change.
| Cause | Where you see it | Fix |
|---|---|---|
| Outbound gateway adds footer or disclaimer | Body ends with text the sender did not write; fails at every receiver | Let the gateway sign with the client's domain, or move the disclaimer to the mail platform before signing |
| Third-party email signature service | Signature block appears only on mail through the service; Received shows a round trip |
Have the service sign with the client's domain, or route so platform signing happens after the service |
| Link rewriting on relayed or forwarded mail | URLs in the delivered body point at the gateway's rewrite domain | Exclude internal relays and onward-forwarded mail from rewriting, or have the rewriting hop seal with ARC |
| Antivirus or external-sender banner | Banner text inside the body; ARC or test shows pass before the banner hop | Apply banners only on final inbound delivery, not on mail that leaves again |
| Mailing list footers | List-Id header present; footer with unsubscribe text |
Lists you run: stop modifying or re-sign after modifying. Lists you do not: rely on the list's ARC and the receiver's trust |
| Forwarder re-encodes MIME | Content-Transfer-Encoding differs from the original |
Sign 7-bit content at source (RFC 6376 Section 5.3); ask the forwarder to stop rebuilding MIME |
| Whitespace or line ending changes | Diff shows only spaces, tabs or trailing whitespace | Switch the signer to c=relaxed/relaxed |
| Application signs before final content | Fails for every message from one sender, even with no intermediary | Ask the vendor to sign after tracking and encoding steps; test with a direct send |
Should the gateway do the DKIM signing?
Often, yes. RFC 6376 Section 5.5 says entities that modify messages "MUST make such modifications before re-signing the message". If an outbound gateway must add a disclaimer, let it sign with a selector under the client's domain so its signature is the last one added. Publish that selector in the client's DNS, document it in your selector register, and remove it during client offboarding. The gateway-specific guides cover the details for secure email gateways in general, Proofpoint and a gateway in front of Microsoft 365.
Should you switch to relaxed/relaxed canonicalisation?
Yes, where the platform lets you choose, but understand its limits. relaxed body canonicalisation absorbs trailing whitespace and collapsed spaces, which fixes failures caused by systems that tidy whitespace. It does nothing for added footers, banners, rewritten links or re-encoded MIME parts, which are the usual causes.
Does ARC fix body hash failures?
Not directly. ARC does not repair the broken signature. It lets an intermediary that modified the body record that DKIM passed when the message arrived, and a receiver may choose to trust that record. RFC 8617 Section 7.2.1 says a DMARC processor "MAY" accept the chain's assessments "as a matter of local policy", and the RFC is Experimental. Microsoft 365 lets admins configure trusted ARC sealers, and its compauth reason 130 shows when an ARC result overrode a DMARC failure.
Why not use the l= body length tag?
l= limits the body hash to the first N octets, so a footer appended afterwards does not break it. That is exactly the problem. RFC 6376 Section 8.2 says signers "should be extremely wary of using this tag", because an attacker can append content to a validly signed message, and it adds that assessors "might wish to ignore signatures that use the tag." It also widens the scope for the abuse described in DKIM replay attacks. Fix the order of signing instead.
How should an MSP handle this across client tenants?
Treat a body hash failure as a mail flow design issue. It usually appears after a change: a new gateway, a disclaimer rule, a signature service or a migration. Put those changes through change control with a before-and-after test message, and record which system signs last for each client.
A short checklist per client:
- Map the outbound path. Mail platform, gateway, signature service, relays. Mark where content changes and where signing happens.
- Keep a selector register. Platform selectors and gateway selectors, with owner and date, so offboarding removes the right records.
- Watch aggregate reports for DKIM fail by source. A sudden drop in DKIM pass for one source usually lines up with a change on that path.
- Do not raise DMARC policy on SPF alone. Before moving from
p=nonetop=quarantineand thenp=reject, make sure the main sources pass aligned DKIM, so forwarding does not turn a hidden body hash failure into rejected mail.
For UK clients, what the NCSC recommends for DMARC includes collecting aggregate reports, and those reports are where a body hash problem usually first shows up as a DKIM failure for one source. DMARC AI monitors aggregate reports across all client domains in one multi-tenant view and uses AI to classify sending sources, which makes a source with failing DKIM easier to spot.
Frequently asked questions
Is dkim=fail (body hash did not verify) a DNS problem?
Usually not. The verifier has already found the key; otherwise you would see a "no key" or permerror result. The body hash check happens before the signature is tested, and it fails because the content changed after signing. Look at gateways, footers, banners and forwarders, not at the DKIM TXT record.
Why does DKIM fail with body hash did not verify in Office 365?
Microsoft 365 reports dkim=fail (body hash did not verify) when a message's body changed between signer and Exchange Online. Common causes are a disclaimer or signature service after signing, a gateway in front of Microsoft 365 rewriting links, or on-premises hybrid routing. A compauth reason of 108 points to modification by earlier legitimate hops.
Can relaxed canonicalisation fix body hash did not verify?
Only when the change is whitespace. Relaxed body canonicalisation ignores trailing whitespace, collapses runs of spaces and tabs, and ignores empty lines at the end. Footers, banners, rewritten URLs and MIME re-encoding still break the hash, so for those you need to move signing after the modification or stop the modification.
Will mail be rejected if DKIM body hash fails?
Not necessarily. DMARC passes if SPF passes and aligns, or if another aligned DKIM signature survives. The message is rejected for authentication reasons only if DMARC fails and the domain's policy is p=reject, and the receiver applies it. Relying on SPF alone is fragile, because forwarding breaks SPF.
What is the difference between dkim body hash mismatch and signature did not verify?
A body hash mismatch means the canonicalised body differs from the bh= value, so the body changed. "Signature did not verify" means the body matched but the signed headers changed, or the public key in DNS does not match the private key. The first points to content processing; the second to headers, selectors and keys.
Final thoughts
"Body hash did not verify" is DKIM working as designed: it detected that the body changed after signing. The fix is rarely in DNS. Find the last hop where DKIM passed, identify what that next system adds or rewrites, and make sure the final signature is applied after it.
For a single message, two test sends and an Authentication-Results comparison usually locate the hop. For a client portfolio, aggregate reports show which sources lost DKIM, and the common DMARC errors guide covers what to check next once DKIM is fixed.