5

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=;
    b=ILyB0JLZLWTig346yGWzmOwk+bEgr0k3hjYyPovA4B3+ggRshzTX9yDeAeklEmYaq4H768zZc0Vn6tR9YpngllkHJ6XTf3lTPr570yWOEhE8dvCkq+M0CBXmxEApHJmoKq2Oeh7sFCHVWGiN8JXYa8ohgsSFEd5Z+xHFlj3AvbI=;

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?

4
  • 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

3

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]
[LF]
[LF]
<?php echo $content_for_layout; ?> [LF]

But this works as it should

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

Not the space before the last [LF].

1
  • 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 .