Skip to content

Commit

Permalink
Merge pull request #14665 from opf/fix/51799/imap-deprecated-options
Browse files Browse the repository at this point in the history
Use non-deprecated call option for imap ssl
  • Loading branch information
klaustopher committed Jan 29, 2024
2 parents 3c19f31 + ac550bf commit 48e6cb2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/redmine/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ def check(imap_options = {}, options = {})
def connect_imap(imap_options)
host = imap_options[:host] || '127.0.0.1'
port = imap_options[:port] || '143'
ssl = imap_options[:ssl]
ssl_verification = imap_options[:ssl_verification]
imap = Net::IMAP.new(host, port, ssl, nil, ssl_verification)
verify_mode = imap_options[:ssl_verification] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
ssl_params =
if imap_options[:ssl]
{ verify_mode: }
else
false
end

imap = Net::IMAP.new(host, port:, ssl: ssl_params)

imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?

Expand Down

0 comments on commit 48e6cb2

Please sign in to comment.