Skip to content

Commit

Permalink
allow for mail system without authentication (#1019)
Browse files Browse the repository at this point in the history
* allow for mail system without authentication

* try to fix travis build
  • Loading branch information
einhirn committed Mar 20, 2020
1 parent 7fa7d2f commit bf04743
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf04743

Please sign in to comment.