From bf04743bc543046b092d3690b3b15a226691f856 Mon Sep 17 00:00:00 2001 From: Christian Marg Date: Fri, 20 Mar 2020 16:57:56 +0100 Subject: [PATCH] allow for mail system without authentication (#1019) * allow for mail system without authentication * try to fix travis build --- config/environments/production.rb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 879cc797ec..4396a57bd7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -82,15 +82,24 @@ # Tell Action Mailer to use smtp server, if configured config.action_mailer.delivery_method = ENV['SMTP_SERVER'].present? ? :smtp : :sendmail - ActionMailer::Base.smtp_settings = { - address: ENV['SMTP_SERVER'], - port: ENV["SMTP_PORT"], - domain: ENV['SMTP_DOMAIN'], - user_name: ENV['SMTP_USERNAME'], - password: ENV['SMTP_PASSWORD'], - authentication: ENV['SMTP_AUTH'], - enable_starttls_auto: ENV['SMTP_STARTTLS_AUTO'], - } + ActionMailer::Base.smtp_settings = if ENV['SMTP_AUTH'].present? && ENV['SMTP_AUTH'] != "none" + { + address: ENV['SMTP_SERVER'], + port: ENV["SMTP_PORT"], + domain: ENV['SMTP_DOMAIN'], + user_name: ENV['SMTP_USERNAME'], + password: ENV['SMTP_PASSWORD'], + authentication: ENV['SMTP_AUTH'], + enable_starttls_auto: ENV['SMTP_STARTTLS_AUTO'], + } + else + { + address: ENV['SMTP_SERVER'], + port: ENV["SMTP_PORT"], + domain: ENV['SMTP_DOMAIN'], + enable_starttls_auto: ENV['SMTP_STARTTLS_AUTO'], + } + end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = true