Skip to content
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

README: clarify that direct TLS for SMTP is not supported, STARTTLS is. #650

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

aghoulcoder
Copy link
Contributor

@aghoulcoder aghoulcoder commented May 30, 2023

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

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
@WithoutPants WithoutPants added the documentation Improvements or additions to documentation label Jun 6, 2023
@WithoutPants WithoutPants merged commit f158480 into stashapp:master Jun 6, 2023
2 checks passed
@aghoulcoder aghoulcoder deleted the mailtls branch June 6, 2023 10:41
Maista6969 pushed a commit to Maista6969/stash-box that referenced this pull request Jun 24, 2023
…s. (stashapp#650)

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
feederbox826 pushed a commit to feederbox826/stash-box that referenced this pull request Nov 15, 2023
…s. (stashapp#650)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants