A lot of debugging went in to this, but I eventually managed to trace the issue back to the mimemail_rfc_headers function of Mime Mail.
Basically Mimemail creates headers like this:
From:foo@bar.com
To:bar@foo.com
By logging the temp files of OpenDKIM, I could see it was using the headers in the format shown in the RFC 822 examples, like this:
From: foo@bar.com
To: bar@foo.com
This meant that the DKIM signature for the mail is created with the space, but the mail is delivered without a space so when the headers are hashed by the client, DKIM fails.
I haven't been able to create a patch for this, but I did the following, to make Mime Mail output headers as per the RFC examples and DKIM then passes without issue.
In "/mimemail.inc", Line 40, change:
From this:
$header .= $key . ":" . $value . $crlf;
To this:
$header .= $key . ": " . $value . $crlf;
Comments
Comment #1
sgabe commentedI think both format should be fine, since the separator character is the colon.