README: clarify that direct TLS for SMTP is not supported, STARTTLS is. #650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation of the stash-box email package uses the smtp.SendMail function which is part of the go standard library. But this function only supports plain tcp connections and upgrades them through STARTTLS. net/smtp has no function that can establish a TLS/TCP connection (aka SMTPS).
When stash-box is configured to use a TLS port for email, it initiates a plain tcp connection waiting for the SMTP server to start an SMTP handshake. But the SMTP(S) server is expecting a TLS handshake so stash-box hangs indefinitely until the TCP connection times out at which point it returns "EOF". This is confusing and time-consuming for administrators to investigate. Hopefully, this README clarification can help avoid this confusion in the future.
Ultimately, if someone wants to put in the effort to properly implement SMTPS support, it can be done with a higher-level package such as emersion/go-smtp.
https://pkg.go.dev/github.com/emersion/go-smtp#DialTLS