allow for mail system without authentication (#1019)

* allow for mail system without authentication

* try to fix travis build
This commit is contained in:
Christian Marg 2020-03-20 16:57:56 +01:00 committed by GitHub
parent 7fa7d2f525
commit bf04743bc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 9 deletions

View File

@ -82,15 +82,24 @@ Rails.application.configure do
# Tell Action Mailer to use smtp server, if configured # Tell Action Mailer to use smtp server, if configured
config.action_mailer.delivery_method = ENV['SMTP_SERVER'].present? ? :smtp : :sendmail config.action_mailer.delivery_method = ENV['SMTP_SERVER'].present? ? :smtp : :sendmail
ActionMailer::Base.smtp_settings = { ActionMailer::Base.smtp_settings = if ENV['SMTP_AUTH'].present? && ENV['SMTP_AUTH'] != "none"
address: ENV['SMTP_SERVER'], {
port: ENV["SMTP_PORT"], address: ENV['SMTP_SERVER'],
domain: ENV['SMTP_DOMAIN'], port: ENV["SMTP_PORT"],
user_name: ENV['SMTP_USERNAME'], domain: ENV['SMTP_DOMAIN'],
password: ENV['SMTP_PASSWORD'], user_name: ENV['SMTP_USERNAME'],
authentication: ENV['SMTP_AUTH'], password: ENV['SMTP_PASSWORD'],
enable_starttls_auto: ENV['SMTP_STARTTLS_AUTO'], 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. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true