Skip to content

Commit

Permalink
Fix SMTP settings
Browse files Browse the repository at this point in the history
  • Loading branch information
vitallium committed Feb 20, 2018
1 parent bfb00c3 commit 0fa558d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require Rails.root.join('config/smtp')

Rails.application.configure do
config.cache_classes = true
config.eager_load = true
Expand All @@ -10,7 +12,7 @@
config.log_level = :debug
config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = ENV["SMTP_SETTINGS"]
config.action_mailer.smtp_settings = SMTP_SETTINGS
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
Expand Down
9 changes: 5 additions & 4 deletions config/smtp.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
SMTP_SETTINGS = {
address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
address: ENV["SMTP_ADDRESS"], # example: "smtp.sendgrid.net"
authentication: :plain,
domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
domain: ENV["SMTP_DOMAIN"], # example: "heroku.com"
enable_starttls_auto: true,
password: ENV.fetch("SMTP_PASSWORD"),
password: ENV["SMTP_PASSWORD"],
port: "587",
user_name: ENV.fetch("SMTP_USERNAME"),
user_name: ENV["SMTP_USERNAME"],
openssl_verify_mode: "none"
}.freeze

if ENV["EMAIL_RECIPIENTS"].present?
Expand Down

0 comments on commit 0fa558d

Please sign in to comment.