-
Notifications
You must be signed in to change notification settings - Fork 931
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
Setting enable_starttls_auto to false will not work with Ruby 3 #1434
Milestone
Comments
Ha good point! 😂 |
Fixed by #1435, targeting Mail 2.8.0 since it subtly changes config behavior. |
tx! |
Any updates on this? The PR seems to be abandoned. |
FWIW: I have been using the following patch/hack as a workaround. module SMTPFix
def initialize(address, port = nil)
super
@starttls = false
end
end
Net::SMTP.prepend SMTPFix |
Closed
bygf
pushed a commit
to bygf/charts-gitlab
that referenced
this issue
Apr 14, 2023
This commit fixes mail sending when TLS is disabled. In Ruby 3.0.5, net-smtp v0.2.1 enabled TLS by default if the server advertises STARTTLS support. However, mail v2.7.1 didn't explicitly disable TLS (mikel/mail#1434), so TLS may be used with Ruby 3 even if it is disabled. mail v2.8.1 has since fixed this issue via mikel/mail#1480. However, mail v2.8.1 has a bug in the logic for retrieving the settings (https://github.com/mikel/mail/blob/2.8.1/lib/mail/network/delivery_methods/smtp.rb#L114): ``` tls = settings[:tls] || settings[:ssl] ``` If `settings[:tls]` is `false` and `settings[:ssl]` is `nil`, then the result of `false || nil` is `nil`. This means that TLS cannot be disabled if `settings[:tls]` is set to `false`. To fix this, just add a redundant `ssl` config parameter. This came out of https://gitlab.com/gitlab-org/gitlab/-/issues/399241. Changelog: fixed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In SMTP class, there is a setting
:enable_starttls_auto
which can be true or false. By default this setting istrue
.In Ruby 2.x, starttls is false, in Ruby 3 :auto.
The problem is that in delivery_methods smtp file , in method
build_smtp_session
there is no way to disable starttls, rather there is just a check to enable it, so starttls is always set to auto or true.The text was updated successfully, but these errors were encountered: