I've recently implemented DKIM using Mailkit / Mimekit in a .net web project. Previously I was sending plain HTML emails, and everything was fine. Now that I'm preparing the message using 7 bit encoding I keep losing periods (full stops).
The only thing I can think of is that I'm falling foul of dot-stuffing (the periods are missing in the same place consistently) but I don't know how to approach this. It should be noted that the DKIM is failing in the client due to the content not matching (ie. the missing periods)
Reference to dot-stuffing (see second bullet point under 4.5.2): https://www.rfc-editor.org/rfc/rfc5321#section-4.5.2
Note: if I send the exact same email without DKIM using the signing function the content is 100% correct (nothing missing).
Can anyone offer any advice, or show me if I'm being a bit thick here?
Many thanks!
Public Sub DkimSign(ByRef message As MimeMessage)
...
Dim signer = New DkimSigner(keyPath, dkimDomain, dkimSelector) With {.SignatureAlgorithm = DkimSignatureAlgorithm.RsaSha256}
message.Prepare(EncodingConstraint.SevenBit)
message.Sign(signer, headers, headerAlgorithm, bodyAlgorithm)
End Sub