Skip to content

Commit

Permalink
chore: Fix SMTP mailer config defaults (chatwoot#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
sojan-official authored Mar 16, 2021
1 parent fe8fc57 commit e44e9fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/initializers/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

# Config related to smtp
smtp_settings = {
domain: ENV.fetch('SMTP_DOMAIN', ''),
address: ENV.fetch('SMTP_ADDRESS', 'localhost'),
port: ENV.fetch('SMTP_PORT', 587)
}

smtp_settings[:authentication] = ENV.fetch('SMTP_AUTHENTICATION', 'login').to_sym if ENV.fetch('SMTP_AUTHENTICATION', '').present?
smtp_settings[:authentication] = ENV.fetch('SMTP_AUTHENTICATION', 'login').to_sym if ENV['SMTP_AUTHENTICATION'].present?
smtp_settings[:domain] = ENV['SMTP_DOMAIN'] if ENV['SMTP_DOMAIN'].present?
smtp_settings[:user_name] = ENV['SMTP_USERNAME']
smtp_settings[:password] = ENV['SMTP_PASSWORD']
smtp_settings[:enable_starttls_auto] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_ENABLE_STARTTLS_AUTO', true))
smtp_settings[:openssl_verify_mode] = ENV.fetch('SMTP_OPENSSL_VERIFY_MODE', 'peer')
smtp_settings[:openssl_verify_mode] = ENV['SMTP_OPENSSL_VERIFY_MODE'] if ENV['SMTP_OPENSSL_VERIFY_MODE'].present?
smtp_settings[:ssl] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_SSL', true)) if ENV['SMTP_SSL']
smtp_settings[:tls] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_TLS', true)) if ENV['SMTP_TLS']

Expand Down

0 comments on commit e44e9fc

Please sign in to comment.