From 2c374cd97cea67447cccee004ae7fe189db9abc5 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 16 Mar 2016 12:13:40 +0100 Subject: [PATCH] Adding e-mail configuration --- .env.production.sample | 12 ++++++++++++ config/environments/production.rb | 12 ++++++++++++ config/initializers/devise.rb | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index 704eb6be39..3460328819 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -1,5 +1,17 @@ +# Service dependencies REDIS_HOST=redis + +# Federation LOCAL_DOMAIN=example.com LOCAL_HTTPS=true + +# Application secrets PAPERCLIP_SECRET= SECRET_KEY_BASE= + +# E-mail configuration +SMTP_SERVER=smtp.mailgun.org +SMTP_PORT=587 +SMTP_LOGIN= +SMTP_PASSWORD= +SMTP_FROM_ADDRESS=notifications@example.com diff --git a/config/environments/production.rb b/config/environments/production.rb index 5c1b32e486..b0236d09e3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -76,4 +76,16 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # E-mails + config.action_mailer.smtp_settings = { + :port => ENV['SMTP_PORT'], + :address => ENV['SMTP_SERVER'], + :user_name => ENV['SMTP_LOGIN'], + :password => ENV['SMTP_PASSWORD'], + :domain => config.x.local_domain, + :authentication => :plain, + } + + config.action_mailer.delivery_method = :smtp end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 89747999aa..4ddef45ef1 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -12,7 +12,7 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + config.mailer_sender = ENV['SMTP_FROM_ADDRESS'] || 'notifications@localhost' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer'