I've got magento 2.3 running on apache with php 7.2. I've got email going out through postfix. I'm trying to get DKIM set up using opendkim. The issue i'm seeing is that emails with html formatting (such as the out-of-the-box newsletter subscription confirmation) email fail the DKIM check on the receiving end with the error "body hash did not verify". I can generate simple text-only emails using the newsletter feature in Magento and those go out and get signed without issue. I'm suspecting the issue is related to something splitting long lines somewhere around 998 characters. I believe perhaps this long line length is causing issues with openDKIM. I'm trying to figure out where this line splitting is occurring so I can throttle it back to around 900 characters.

Any ideas oh what could be going on are helpful. Maybe i'm barking up the wrong tree with the line length thing.

1 Answer 1


I had the same issue after upgrading to Magento 2.3 because this release uses zend mail 2.x.

The reason of the broken dkim signature is the line lengh. The css minimization puts everything in one line. I solved the issue by overloading Message.php (Magento\Framework\Mail\Message) and adding the following code in method setBodyHtml($content):

  • This is the correct answer and should be accepted and upvoted.
    – 1337_sanc
    Commented Jul 10, 2020 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.