Commit e1baa485 authored by Douwe Maan's avatar Douwe Maan

Fix `gitlab:incoming_email:check` task.

parent bbdb9ba0
......@@ -728,13 +728,15 @@ namespace :gitlab do
def check_imap_authentication
print "IMAP server credentials are correct? ... "
config = Gitlab.config.incoming_email
config_path = Rails.root.join('config', 'mail_room.yml')
config_file = YAML.load(ERB.new(File.read(config_path)).result)
config = config_file[:mailboxes].first
if config
begin
imap = Net::IMAP.new(config.host, port: config.port, ssl: config.ssl)
imap.starttls if config.start_tls
imap.login(config.user, config.password)
imap = Net::IMAP.new(config[:host], port: config[:port], ssl: config[:ssl])
imap.starttls if config[:start_tls]
imap.login(config[:email], config[:password])
connected = true
rescue
connected = false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment