Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#403 DKIM Body Hash incorrect (+fix)

5.0
closed
nobody
Phpmailer (265)
5
2015-03-05
2011-09-06
Jon
No

When using this class with EXIM SMTP server, I was receiving "wrong body hash" report from Port25's automatic authentication verifier.

Eventually I figured out to change the following line in DKIM_Add() from:

$DKIMb64  = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body

to:

$DKIMb64  = base64_encode(pack("H*", sha1("\r\n" . preg_replace("/\r\n$/", "", $body)))) ; // Base64 of packed binary SHA-1 hash of body

So that it added an extra CRLF to the start of the body and removed the trailing CRLF from the body.

Discussion

  • Thank you!

     
  • Marcus Bointon
    Marcus Bointon
    2013-03-20

    • status: open --> closed
     
  • Marcus Bointon
    Marcus Bointon
    2013-03-20

    I'm getting the opposite result - with your code I get a body hash failure, with what's there already it passes. This may be because of other changes in PHPMailer.