Commit f389f78e authored by John Long's avatar John Long

Support multiple mailboxes incoming email check

parent 0f6f3f2b
......@@ -28,9 +28,13 @@ module SystemCheck
private
def try_connect_imap
imap = Net::IMAP.new(config[:host], port: config[:port], ssl: config[:ssl])
imap.starttls if config[:start_tls]
imap.login(config[:email], config[:password])
config.each do |mailbox|
$stdout.puts "\nChecking #{mailbox[:email]}\n"
imap = Net::IMAP.new(mailbox[:host], port: mailbox[:port], ssl: mailbox[:ssl])
imap.starttls if mailbox[:start_tls]
imap.login(mailbox[:email], mailbox[:password])
$stdout.puts "Connected to #{mailbox[:email]}\n"
end
true
rescue => error
@error = error
......@@ -51,7 +55,7 @@ module SystemCheck
erb.filename = mail_room_config_path
config_file = YAML.load(erb.result)
config_file.dig(:mailboxes, 0)
config_file.dig(:mailboxes)
end
end
end
......
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