Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ def capable_starttls?
# true if the EHLO response contains +key+.
def capable?(key)
return nil unless @capabilities
@capabilities[key] ? true : false
return true if @capabilities[key]
key = key.to_s
@capabilities.each_key.any? { |capability| capability&.casecmp?(key) }
end

# The server capabilities by EHLO response
Expand Down
1 change: 1 addition & 0 deletions test/net/smtp/test_smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_server_capabilities
smtp = Net::SMTP.start('localhost', port, starttls: false)
assert_equal({"STARTTLS"=>[], "AUTH"=>["PLAIN"]}, smtp.capabilities)
assert_equal(true, smtp.capable?('STARTTLS'))
assert_equal(true, smtp.capable?('starttls'))
assert_equal(false, smtp.capable?('DOES-NOT-EXIST'))
else
port = fake_server_start
Expand Down