fix: health_check SMTP check when no auth required (#2281)

This commit is contained in:
Julien Gribonvald 2020-12-08 23:46:58 +01:00 committed by GitHub
parent 42bb568172
commit 97e961d580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -65,8 +65,12 @@ class HealthCheckController < ApplicationController
smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)
end
smtp.start(settings[:domain]) do |s|
s.authenticate(settings[:user_name], settings[:password], settings[:authentication])
if settings[:authentication].present? && settings[:authentication] != "none"
smtp.start(settings[:domain]) do |s|
s.authenticate(settings[:user_name], settings[:password], settings[:authentication])
end
else
smtp.start(settings[:domain])
end
rescue => e
raise "Unable to connect to SMTP Server - #{e}"