Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DKIM signature has a wrong body hash when sending via a specific SMTP server #2739

Closed
fdumortier opened this issue Jul 29, 2022 · 3 comments
Closed

Comments

@fdumortier
Copy link

Problem description

When sending DKIM-signed mails through a specific SMTP server from my OVH hoster with my credentials, the received body hash is wrong, while it's OK with 2 other SMTP servers. I checked it via Gmail and mail-tester.com. Any idea what causes this?

Code to reproduce

Too risky to give you this possibility here. Send me a personal message and I'll provide you with the URL to reproduce this issue.

Debug output

Gmail : "body hash did not verify"

@Synchro
Copy link
Member

Synchro commented Jul 30, 2022

The most likely explanation is that the mail server you're sending through is altering your message, which will cause the DKIM validation to fail. I suggest you grab an exact copy of the message as sent from debug output (or by calling getSentMIMEMessage()), and then compare it (use a diff tool) to what turns up at the receiving end.

@Synchro Synchro closed this as completed Jul 30, 2022
@fdumortier
Copy link
Author

fdumortier commented Aug 1, 2022

The most likely explanation is that the mail server you're sending through is altering your message, which will cause the DKIM validation to fail. I suggest you grab an exact copy of the message as sent from debug output (or by calling getSentMIMEMessage()), and then compare it (use a diff tool) to what turns up at the receiving end.

Indeed, many thanks: the SMTP server I used to send the mail altered the "Message-ID: " value. I don't know why. I'll open an issue with my hoster.

I read discussion #1965 and understand that including "Message-ID:" to the DKIM fields is "the recommended set straight from RFC6376."

But why not let it to the programmer like me to choose which fields to include/remove?

@Synchro
Copy link
Member

Synchro commented Aug 1, 2022

It would be a nice-to-have feature, but at this point I don't really want to touch the DKIM code! DKIM is really difficult to test, which is why I set about writing a DKIM validator, but that has stalled as I was finding that too difficult, even though it's got quite a long way. PRs welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants