How do I fix DKIM failing body hash verification?

Summary

DKIM body hash verification failures are primarily caused by alterations to the email content after the DKIM signature has been applied. These modifications can be due to various factors, including text encoding issues (particularly with Outlook), line wrapping, character set conversions, and the addition of footers, disclaimers, or content by auto-responders, forwarding systems, list servers, or even the receiving mail server. Experts advise ensuring the DKIM signing process occurs after all intended modifications, and that consistent encoding and line endings are used. Troubleshooting involves identifying the source of the modification through header analysis, and considering regenerating DKIM keys or comparing results with Gmail as a benchmark.

Key findings

  • Post-Signature Modifications: Email content is being altered after the DKIM signature is applied.
  • Diverse Modification Sources: Modifications can arise from MTAs, mail clients, intermediate servers, automated systems, or even the recipient's server.
  • Encoding and Line Endings: Inconsistent character encoding and line endings contribute to body hash mismatches.
  • Microsoft Outlook: Outlook-specific issues with text encoding can trigger DKIM failures.

Key considerations

  • Signing Process Timing: Ensure the DKIM signing occurs after all intended modifications (footers, disclaimers, etc.).
  • Encoding Consistency: Maintain consistent character encoding (UTF-8) and line endings (LF).
  • Header Analysis: Examine email headers to trace the path and pinpoint where content is altered.
  • DKIM Key Regeneration: Consider regenerating DKIM keys if the signer is suspected to be faulty.
  • Benchmark Testing: Use Gmail as a benchmark to identify if the issue is widespread or specific to certain recipients.
  • Tamper Detection: Check for tampering during transit.

What email marketers say
7Marketer opinions

The primary cause of DKIM body hash verification failures is modification of the email content after the DKIM signature has been applied. These modifications can be introduced by various sources, including the sending mail server, intermediate servers, receiving email clients, or automated processes like auto-responders or footer insertion. Troubleshooting involves identifying where and how the message content is being altered and ensuring the DKIM signing process occurs after all modifications.

Key opinions

  • Content Modification: Email content is being altered after DKIM signing, causing the body hash to fail verification.
  • Source of Changes: Modifications can originate from the sending server, intermediary servers, receiving email clients, or automated processes.
  • Common Culprits: Common culprits include adding footers, disclaimers, or auto-responder content, as well as changes to line endings or character encoding.

Key considerations

  • Signing Process Timing: Ensure the DKIM signing process occurs *after* all automated modifications or content additions.
  • Consistency Checks: Ensure consistent line endings (LF) and character encoding (UTF-8) to prevent alterations.
  • Header Analysis: Examine email headers to track the message's path and identify potential modification points.
  • Key Verification: Verify that the correct DKIM key is being used for signing.
  • Transit Tampering: Check for potential tampering during transit.
  • Monitoring: Implement monitoring to detect content alterations.
Marketer view

Email marketer from Mailhardener responds that if the DKIM signature fails due to body hash mismatch, verify if the sender is correctly signing the email using the correct DKIM key. It also advises to check for possible tampering during transit.

December 2021 - Mailhardener
Marketer view

Email marketer from Super User responds that the 'body hash did not verify' error indicates the message body changed after DKIM signing. This can be due to modifications by mail servers or email clients. Examine the message headers to track the path and identify any potential modification points.

February 2024 - Super User
Marketer view

Email marketer from MXToolbox shares to ensure that your sending server isn't configured to automatically add signatures, disclaimers or footers after DKIM signing. These additions will change the message body and invalidate the DKIM signature.

November 2023 - MXToolbox
Marketer view

Email marketer from Reddit suggests that ensuring consistent line endings (using LF instead of CRLF) and character encoding (UTF-8) can help prevent DKIM body hash failures. Also, check for any server-side scripts that might be adding footers or altering the message body.

December 2022 - Reddit
Marketer view

Email marketer from cPanel Forum explains that if the DKIM body hash fails, it is essential to ensure that the signing process occurs *after* any automated modifications, such as adding footers. Moving the signing process later can often resolve the issue.

July 2023 - cPanel Forum
Marketer view

Email marketer from EmailOnAcid explains that a common cause for body hash verification failure is when the email content is altered after DKIM signing, either by the sending server, an intermediary server, or the receiving server. Implement monitoring to detect such alterations.

June 2021 - EmailOnAcid
Marketer view

Email marketer from Stack Overflow explains that a DKIM body hash failure can happen if your mail server is modifying the message after it's signed. They suggest ensuring that no processes are altering the message content, especially line endings or character encodings.

September 2022 - Stack Overflow

What the experts say
5Expert opinions

DKIM body hash verification failures primarily stem from content modifications occurring after the DKIM signature is applied. These changes can be due to various factors, including text encoding issues (specifically with Microsoft Outlook), modifications by auto-responders, forwarding systems, list servers, or even the receiving mail server. Troubleshooting involves identifying the source of the modification and ensuring that the signing process occurs after any content alterations. Utilizing Google as a benchmark can help isolate issues specific to certain email providers like Microsoft.

Key opinions

  • Post-Signature Modification: Email content is being modified after the DKIM signature is applied, leading to body hash mismatches.
  • Encoding Issues: Text encoding problems, particularly with Microsoft Outlook, can cause body hash verification to fail.
  • Source Identification: Modifications can occur due to auto-responders, forwarding systems, list servers, or the receiving mail server.
  • Signer Problems: The signer itself might be broken, requiring regeneration of the public/private key pair.

Key considerations

  • Signing Timing: Ensure the DKIM signing process happens *after* all content modifications.
  • Encoding Consistency: Investigate and address potential text encoding issues, especially if problems are isolated to Microsoft Outlook.
  • Header Examination: Examine email headers to trace the message's path and pinpoint where content is being altered.
  • Benchmark Testing: Use Google as a benchmark to determine if the issue is widespread or specific to certain email providers.
  • Key Regeneration: Consider regenerating the public/private key pair if the signer is suspected to be broken.
Expert view

Expert from Email Geeks explains that if DKIM body hash verification is failing in both Gmail and Outlook, the signer is likely broken or the message is being modified in transit. Regenerating the public/private key pair is the first suggestion.

April 2023 - Email Geeks
Expert view

Expert from Email Geeks shares that Google is a good benchmark for checking email authentication due to its robust system and easy result retrieval. Problems at Microsoft should be verified against Google first.

April 2023 - Email Geeks
Expert view

Expert from Email Geeks explains that if DKIM body hash verification is failing only in Outlook, it's likely a text encoding issue in the message, causing Microsoft's system to have problems with the body hash. This can be fixed by changing the encoding of the outbound MTA.

March 2024 - Email Geeks
Expert view

Expert from SpamResource.com explains that DKIM failures, including body hash mismatches, often occur when the email content is modified after the DKIM signature is applied. This can be due to auto-responders, forwarding, or list servers adding footers or disclaimers. Ensure that your signing process occurs after all content modifications.

September 2023 - SpamResource.com
Expert view

Expert from Word to the Wise explains that one of the primary reasons for DKIM failing to verify is content modification, which can affect the body hash. This may be caused by mailing list software, corporate disclaimers, or even the receiving mail server modifying the email. They suggest examining the email headers to determine where the content was changed.

April 2021 - Word to the Wise

What the documentation says
3Technical articles

DKIM body hash verification failures are primarily caused by alterations to the email body after the DKIM signature has been applied. These changes, even minor ones like whitespace, character set conversions, line wrapping by MTAs, or the addition of disclaimers, invalidate the signature. The core issue is the sensitivity of DKIM signatures to any modification of the message content after signing.

Key findings

  • Post-Signing Alteration: The message body is being modified in transit after DKIM signing.
  • Sensitivity to Changes: DKIM signatures are highly sensitive to even minor changes in the email body.
  • Common Causes: Common causes of alteration include line wrapping, character set conversion, and the addition of disclaimers.

Key considerations

  • Prevent Alterations: Ensure that the message content is not modified by intermediate servers, MTAs, or mail clients after signing.
  • Content Review: Review the message content for any transformations, such as added footers, changed character encoding, or altered line breaks.
  • Signing Process Timing: Confirm that the DKIM signing process takes place after all intended modifications to the message body.
Technical article

Documentation from RFC 6376 specifies that DKIM signatures are sensitive to even minor changes in the message body. Any modification, including whitespace changes, character encoding differences, or the addition of content, will cause the body hash verification to fail.

November 2023 - RFC Editor
Technical article

Documentation from OpenDKIM Project suggests that if a DKIM signature verification fails due to body hash mismatch, ensure that the message content hasn't been modified by intermediate servers or mail clients. Check for any transformations like adding footers, changing character encoding, or altering line breaks.

February 2023 - OpenDKIM.org
Technical article

Documentation from dkim-milter.org explains that a 'body hash did not verify' error typically indicates that the message body was altered in transit after signing. This could be due to line wrapping by mail transfer agents (MTAs), character set conversion, or the addition of disclaimers.

March 2024 - dkim-milter.org