From 97e961d580fad8949c026b6095779722a729add5 Mon Sep 17 00:00:00 2001 From: Julien Gribonvald Date: Tue, 8 Dec 2020 23:46:58 +0100 Subject: [PATCH] fix: health_check SMTP check when no auth required (#2281) --- app/controllers/health_check_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/health_check_controller.rb b/app/controllers/health_check_controller.rb index c5f5d66f..0c2fbb2d 100644 --- a/app/controllers/health_check_controller.rb +++ b/app/controllers/health_check_controller.rb @@ -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}"