go-gomail / gomail

The best way to send emails in Go.
MIT License
4.3k stars 570 forks source link

Supporting multipart/signed and multipart/encrypted messages #134

Open ianmcorvidae opened 5 years ago

ianmcorvidae commented 5 years ago

This is a new feature request, and I won't be terribly bothered if this is rejected as too niche, but I thought it would be worth starting a conversation. I don't have an immediate use case, but implementing signed and/or encrypted email notifications as part of a service would maybe be a good organizing idea for why someone would want this.

It might be nice if there's a way to create multipart/signed messages with gomail, for example to use PGP/MIME and S/MIME rather than needing to use inline variants of these schemes. As far as I can tell from https://github.com/go-gomail/gomail/blob/81ebce5c23dfd25c6c67194b37d3dd3f338c98b1/writeto.go#L30-40 this is currently not supported.

I'm not sure what the best way to integrate this with the gomail API would be, however, whether it'd best be an "escape hatch" into lower-level options for assembling the message (with users handling the creation of the encrypted or signed parts and their signatures), directly integrating golang.org/x/crypto/openpgp and similar (i.e. gomail handling the signing and encryption too), or some other means.

pedromorgan commented 5 years ago

see #108 and #107