-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSL for e-mail #13
Comments
Thanks for this. I can't confirm it's working : I'm getting the error "wrong host name". This is probably not related to your code. The only reference to this error I can find : jordan-wright/email#103 It's relevant as our SMTP server only accept AUTH login method which is not supported by the email library. I'll try to find another SMTP server to test the feature. |
Just tried with a StartTLS and TLS-capable server. I only changed EMAIL_PORT (587/465) and EMAIL_ENCRYPTION (starttls/tls). I've not been able to find where the error is (go-email, net/smtp ?). All I can say is that go-email use smtp.Dial(addr) in SendWithStartTLS function and tls.Dial("tcp", addr, t) in SendWithTLS. No idea if this could have an impact ... |
I tried it with the following settings and it worked:
Can you test out if it works if you connect via IP address? |
Hello, My settings are : Port 466 is due to my last test with a nginx reverse proxy for SMTP. As last resort, I ran a test container (praqma/network-multitool) with host networking to see if I can also connect with openssl s_client and it worked. Really dunno what else I can try. |
Hi @Azylog , what I found out now is that this error is triggered by the mail server if the hostname that is specified in the PlainAuth differs from the mail server hostname. See https://groups.google.com/g/golang-nuts/c/5j1r43_Q4B8 or prometheus/alertmanager#1174. I just dont know why the encryption method makes a difference here... Is your mail server configured to respond the same hostname on all ports/protocols? |
You sent me on the right direction. I don't really understand clearly where the compared strings come from (server.Name != a.host). Could it be due to the fact you're creating the Auth structure only with 'hostname' and establishing connection to 'hostname:port' ? |
Should be fixed with the new email library. |
Hello,
Still on my deep testing ;-)
May we add an option to use SSL in addition to STARTTLS for e-mail ? Yes, we better use full-TLS than STARTTLS to get an encrypted dialog from the start.
In internal/common/email.go :
Use the TLS variable with :
This will retain compatibility with already-configured instances. In documentation, switch to "none/starttls/ssl" pragma to be able to disable the true/false option later as it's an incompatible change.
Thanks !
The text was updated successfully, but these errors were encountered: