We're sending out e-mails with EXIM 4.71 from a PHP application. DKIM is enabled and is working properly, unless when sending a specific type of mails, which results in dkim=neutral (body hash did not verify).

Received-SPF: pass (google.com: domain of [email protected] designates 2a02:750:5::256 as permitted sender) client-ip=2a02:750:5::256;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of [email protected] designates 2a02:750:5::256 as permitted sender) [email protected];
       dkim=neutral (body hash did not verify) [email protected]
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=letsrace.se; s=dkim;
    h=Content-Transfer-Encoding:Content-Type:Reply-To:From:Subject:To:Message-Id:Date; bh=9CkFmpgBio6ql+M36DtO8Gbw8keno3PlJ6db2JTrwy4=;

The type of e-mail which fails contains a message entered via a HTML form on the site, and other mails sent from this application are fine. I have been suspecting mixed line endings to be the culprit, but haven't been able to improve the situation by normalizing line endings.

Is EXIM performing some cleanup after it creates the DKIM hash?

Any ideas?

  • What are you using to send the mail? Mar 6, 2013 at 12:22
  • PHP mail() -> local EXIM, or what did you mean?
    – Oscar
    Mar 6, 2013 at 12:31
  • This does seems like a white space/EOL issue. If I switch to my default layout for the mails being sent, it works. The only difference (apart from some greetings) is that there is no extra LF after the message.
    – Oscar
    Mar 6, 2013 at 12:58
  • I'm told that the latest Exim update addresses and fixes this problem - released mid December 2015.
    – user331600
    Jan 13, 2016 at 5:19

1 Answer 1


This was very odd, but the following seems to be true:

This does not work, resulting in DKIM body hash fail

<?php echo $heading; ?> [LF]
<?php echo $content_for_layout; ?> [LF]

But this works as it should

<?php echo $heading; ?> [LF]
<?php echo $content_for_layout; ?>[LF]

Not the space before the last [LF].

  • DKIM also fails the same way now if $content_for_layout ends with newlines, but that should be easily fixed with trim().
    – Oscar
    Mar 6, 2013 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .