due to my mail provider's setup, I need to DKIM sign my messages locally. I do this by piping messages composed in mutt through a simple Python script to msmtp.
These messages will fail a DKIM check with a wrong body hash. If I sent an (unsigned) message to myself and sign the incoming message using my script, though, it will pass the check.
The only visible difference between the messages is the order of the DKIM-Signature and Content-Length headers:
# Message received and then signed locally
Content-Length: 76
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; [...]
# Message signed and sent
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; [...]
Content-Length: 76
Is there anything msmtp does to the message which alters the body, rendering the body hash invalid? Any help is greatly appreciated.
Thanks, Jan