DKIM · Body hash · Signing order
DKIM “body hash did not verify”: find what changed the message after signing
The key was found. The signature was read. But the body the receiver hashed is not the body that was signed.
This error is almost never a DNS problem. It means something in the mail path changed the message after the signer signed it.
The fast answer
Do not regenerate keys or republish DNS. Your DNS is fine — the receiver found the key, or it would say so. The first move is a subtraction test: send the same message with each suspect modifier switched off (disclaimer/footer, link rewriting, antivirus banner, gateway inspection) until the failure disappears. Whatever you switched off last is the modifier. The permanent fix is to move that modification before signing, or make the last system in the path the signer.
What you are looking at, in plain words
A DKIM signature contains two parts that matter here: bh=, the hash of the message body exactly as the signer saw it, and b=, the signature over the headers and that hash. The receiver recomputes the body hash from the message it received and compares. Any change to the body after signing — an appended disclaimer, a rewritten link, a security banner, a mailing-list footer, a re-encoding by a firewall doing SMTP inspection — makes the hashes differ, and the verdict is body hash did not verify. Note the precision: a header-only change gives a different failure, and a missing key gives a different failure again. This specific error points at the body, and at timing: signing happened too early in your mail flow.
| Usual modifier | How it changes the body |
|---|---|
| Outbound disclaimer / footer rule | Appends text after signing |
| Link rewriting / click tracking | Rewrites URLs in the body |
| Antivirus banner / gateway footer | Inserts a banner into the body |
| Firewall SMTP inspection (DPI) | Rewrites or re-encodes content in transit |
| Mailing-list footer | Appends text and may re-encode |
Step 0 — Prove which part is failing
- Confirm the pattern: does the failure hit all mail, only mail with disclaimers, only mail through one gateway, or only list mail? The scope names the suspect.
- Send a minimal test message (plain text, no disclaimer, no tracked links) through the same path. If it passes, the infrastructure is sound and a modifier is guilty; if it fails too, the signer itself or a path-wide re-encoder is suspect.
- List every system that touches outbound mail after your signer, in path order: transport rules, gateways, security appliances, lists. One of them edits the body — the test in Fix 1 finds which.
Fix 1 — Isolate the modifier by subtraction
Switch off one suspect at a time and re-test with an identical message: first the outbound disclaimer/footer rule, then link rewriting, then any gateway banner, then (with your network team) SMTP inspection on the firewall. When a test passes, you have found the modifier. Keep notes — “it was the disclaimer rule” is a finding worth writing down for the next person.
Fix 2 — Move the modification before signing
The durable fix is ordering: everything that edits the body must happen before the DKIM signer runs. In Microsoft 365 that means checking transport-rule order so disclaimer rules do not append after signing, or — where the signer is upstream of an unavoidable editor — moving signing to the last system in the path so it signs the final form of the message. If your gateway must both edit and sign, let the gateway be the signer for mail it edits.
Fix 3 — If you cannot move it, re-sign at egress
Where the editing system is also capable of DKIM signing (many gateways are), configure it to sign outbound mail with your domain after it finishes editing, so the signature the receiver verifies covers the final body. Confirm the egress signer uses your domain (d=yourdomain) and a key you control — a signature in the gateway’s own domain does not align for DMARC.
Fix 4 — Where the modifier is not yours, say so and route around it
If a mailing list or a recipient-side system edits the message, you cannot reorder its pipeline. Options: ask the list to stop appending footers, send list mail from a subdomain whose reputation you isolate, or accept that copies through that modifier fail DKIM while your direct mail passes. What you must not do is keep “fixing” your DNS for someone else’s edit.
Prove it worked
- Re-send the previously failing message type (with disclaimer, tracked links, gateway in path) to an outside mailbox and confirm
dkim=passwithheader.d=yourdomain. - Confirm a plain message still passes — the fix must not have broken the clean path.
- Check DMARC for the same messages: with DKIM passing and aligned, DMARC should pass on the DKIM leg even if SPF uses another domain.
Still not working? Work this ladder in order
- Failure follows only some messages. Compare a passing and a failing message body side by side: the difference (footer, rewritten link, banner) is the modifier.
- Failure follows all mail through one gateway. The gateway re-encodes or inspects. Its signing-at-egress setting or its inspection bypass for your mail is the fix.
- Failure appears intermittently. Two paths exist (for example, some mail via the gateway, some direct) and only one edits. Map which messages take which path.
- Failure persists with every modifier off. Re-examine the signer itself: a signer that signs a different body form than it sends (for example, signing before MIME encoding completes) is rare but possible — escalate to the signing platform’s support with a passing and a failing sample.
Mistakes that make it worse
- Rotating DKIM keys for a body-hash failure.
- Adding a second DKIM signature without fixing the modifier — if the body is still edited after the new signature is applied, it fails the same way.
- Disabling DKIM verification complaints by dropping DMARC enforcement.
- Changing three modifiers at once and never learning which one was guilty.
FAQ
Does body hash did not verify mean my DKIM key is wrong?
No. If the key were wrong or missing, the error would say so. This error means the key was found and used, but the received body differs from the signed body.
Can relaxed canonicalisation fix this?
Relaxed canonicalisation tolerates harmless whitespace changes, not added footers, rewritten links or banners. It may mask trivial re-encoding, but it is not a fix for a modifier that changes content — and changing canonicalisation is a signer-side change to make deliberately, not a quick patch.
Why do test messages pass but real mail fails?
Because tests usually skip the modifiers: no disclaimer, no tracked links, no list footer. Test with a real message, through the real path, or the test proves nothing.
Sources
RFC 6376 — DKIM Signatures (bh= body hash, b= signature, canonicalisation) · Microsoft Learn — How to use DKIM for email in your custom domain (DKIM signing in Microsoft 365). The signing-order fixes on this page follow from RFC 6376 §6.1.3: a body change after signing breaks verification.
Did this fix work for you?
Your reaction is stored only in your own browser — it is not sent to us.