]> source.dussan.org Git - redmine.git/commitdiff
IMAP STARTTLS support (#16823).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 27 Jan 2015 20:54:45 +0000 (20:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 27 Jan 2015 20:54:45 +0000 (20:54 +0000)
Patch by Jan Pipek.

git-svn-id: http://svn.redmine.org/redmine/trunk@13950 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/imap.rb
lib/tasks/email.rake

index 3fbc72d452461fa859985431e39e06b9d9c3c51f..418066632b27e457cb356d67491480975c1b752b 100644 (file)
@@ -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|
index b8d22cfbb4179d60dad1bca6d32904241dda6e2a..121afc4a6a0d22f49a612bcbe21344dfaa5a908e 100644 (file)
@@ -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'],