I created a client library to send emails for a webapp.
When the client library makes a connection to the SMTP server, and
then do NOT add Message-Id header, Message-ID (with a capital D)
header is added, and the SMTP server adds a incorrect DKIM-Signature
record 'h' part, invalidating the generated DKIM signature value.
This causes outlook, yahoo, gmail and other email recipients to add
'dkim:fail' to the message which pushes it into junk/spam folder.
The work around is to add to the message a Message-Id with a little
‘d’ header. Then the SMTP server processes the email with the correct
DKIM-Signature, correct DKIM ‘h’ part and does not add a Message-ID
header.
Message-ID fails DKIM, Message-Id is better by OzBob · Pull Request
#142 · dovecot/core (github.com)
https://github.com/dovecot/core/pull/142
Regards Robert