From: Jean-Philippe Lang Date: Tue, 27 Jan 2015 20:54:45 +0000 (+0000) Subject: IMAP STARTTLS support (#16823). X-Git-Tag: 3.0.0~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1184e50ee8de587a8ce906acb7837c9f3dd996e7;p=redmine.git IMAP STARTTLS support (#16823). Patch by Jan Pipek. git-svn-id: http://svn.redmine.org/redmine/trunk@13950 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb index 3fbc72d45..418066632 100644 --- a/lib/redmine/imap.rb +++ b/lib/redmine/imap.rb @@ -24,9 +24,13 @@ module Redmine host = imap_options[:host] || '127.0.0.1' port = imap_options[:port] || '143' ssl = !imap_options[:ssl].nil? + starttls = !imap_options[:tls].nil? folder = imap_options[:folder] || 'INBOX' imap = Net::IMAP.new(host, port, ssl) + if starttls + imap.starttls + end imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil? imap.select(folder) imap.uid_search(['NOT', 'SEEN']).each do |uid| diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake index b8d22cfbb..121afc4a6 100644 --- a/lib/tasks/email.rake +++ b/lib/tasks/email.rake @@ -77,7 +77,8 @@ General options: Available IMAP options: host=HOST IMAP server host (default: 127.0.0.1) port=PORT IMAP server port (default: 143) - ssl=SSL Use SSL? (default: false) + ssl=SSL Use SSL/TLS? (default: false) + starttls=STARTTLS Use STARTTLS? (default: false) username=USERNAME IMAP account password=PASSWORD IMAP password folder=FOLDER IMAP folder to read (default: INBOX) @@ -118,6 +119,7 @@ END_DESC imap_options = {:host => ENV['host'], :port => ENV['port'], :ssl => ENV['ssl'], + :starttls => ENV['starttls'], :username => ENV['username'], :password => ENV['password'], :folder => ENV['folder'],