From 1184e50ee8de587a8ce906acb7837c9f3dd996e7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 27 Jan 2015 20:54:45 +0000 Subject: [PATCH] IMAP STARTTLS support (#16823). Patch by Jan Pipek. git-svn-id: http://svn.redmine.org/redmine/trunk@13950 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/imap.rb | 4 ++++ lib/tasks/email.rake | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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'], -- 2.39.5