Description
The parameters that are used to create the Net::IMAP connection in Mail::IMAP are undocumented:
I believe the documentation was removed in 2007 (ruby/net-imap@e631911e). Pending the following PR: ruby/net-imap#175, the next release of net-imap will print a deprecation warning when those parameters are used. About a year later, they'll be removed entirely.
A bigger issue is that the fifth and final argument is false: that is the verify
parameter and by setting it to false, the SSLContext will have verify_mode: OpenSSL::SSL::VERIFY_NONE
.
Proposal
When Hash.try_convert(enable_ssl)
returns a Hash, that will be used with
Net::IMAP.new(settings[:address],
port: settings[:port],
ssl: Hash.try_convert(settings[:enable_ssl]))
When Hash.try_convert(enable_starttls)
returns a Hash, that will be used with
imap.starttls Hash.try_convert(settings[:enable_starttls])
In this way, any SSLContext attribute can be set.
When enable_ssl
or enable_starttls
are truthy but not hash-like, use {}
. This way, the default is secure.
I can write a PR for this, if you agree with my proposal.