xhit/go-simple-mail

Add an option for mandatory TLS on SMTPServer

danerubado-wk opened this issue · 0 comments

Hello!

I recently attempted to switch to this library to replace https://github.com/go-gomail/gomail as it has been abandoned. I specifically needed the custom connection feature that is provided here to customize the dialer.

Additionally, I wanted to be able to specify that TLS is mandatory.

Right now the behavior for Encryption.STARTTLS is such that it checks with the server to see if STARTTLS is supported. If it is not, it simply falls back to not using TLS. I appreciate this because I can "opportunistically" enable STARTTLS in my application without having to worry about the server.

Still, I would like the option to throw an error if the SMTPServer is configured with TLSMandatory.

gomail had the same issue and merged a fix for it described here: go-mail/mail#23

I tried to put up a PR to this effect but I do not have write access to the repo. Is this something we think we could support?