go-pgpmail icon indicating copy to clipboard operation
go-pgpmail copied to clipboard

writer creates multipart MIME messages without the MIME-Version header

Open konimarti opened this issue 1 year ago • 3 comments

MIME messages must specify the MIME-Version header at the top level of the message to be compliant with the rfc. However, the writer sets only the multipart MIME types, not the MIME-Version.

Users could set the MIME-Version in the header that is passed to pgpmail. But most are not aware of this. It would be helpful if pgpmail would set the MIME-Version directly.

Would it make sense to set the MIME-Version in the writer?

konimarti avatar Jan 21 '24 15:01 konimarti

I'm not sure. pgpmail is supposed to only add PGP-related header fields, not other arbitrary header fields.

emersion avatar Jan 21 '24 15:01 emersion

On Sun Jan 21, 2024 at 4:06 PM CET, Simon Ser wrote:

I'm not sure. pgpmail is supposed to only add PGP-related header fields, not other arbitrary header fields.

Ok, no worries. I just thought I'd bring it to your attention.

go-message.CreateWriter will set the MIME-Version correctly. And in combination with go-pgpmail, the correct cleartext part with the MIME-Version header is wrapped in a new multipart MIME. So one needs to remember to explicitly set the MIME-Version for the top level.

konimarti avatar Jan 21 '24 15:01 konimarti

Hm, that's a good point… And actually, with the examples in the repo, a MIME-Version header field will be added to the encrypted header, which isn't very nice...

I'm not sure what's the best way to fix this issue, but re-opening because I agree it's a valid concern.

emersion avatar Jan 23 '24 10:01 emersion