diff --git a/lib/tasks/configuration.rake b/lib/tasks/configuration.rake index 9e720988..f1203557 100644 --- a/lib/tasks/configuration.rake +++ b/lib/tasks/configuration.rake @@ -44,8 +44,11 @@ def test_smtp smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto) end - smtp.start(ENV['SMTP_DOMAIN'], ENV['SMTP_USERNAME'], ENV['SMTP_PASSWORD'], - ENV['SMTP_AUTH']) do |s| + user = ENV['SMTP_USERNAME'].presence || nil + password = ENV['SMTP_PASSWORD'].presence || nil + authtype = ENV['SMTP_AUTH'].present? && ENV['SMTP_AUTH'] != "none" ? ENV['SMTP_AUTH'] : nil + + smtp.start(ENV['SMTP_DOMAIN'], user, password, authtype) do |s| s.sendmail('test', ENV['SMTP_USERNAME'], 'notifications@example.com') end rescue => e