Commit 3d7327d

mo khan <mo@mokhan.ca>
2015-01-21 05:28:09
move default from address to configuration.
1 parent d4af91f
Changed files (3)
app/mailers/application_mailer.rb
@@ -1,4 +1,3 @@
 class ApplicationMailer < ActionMailer::Base
-  default from: "from@example.com"
   layout "mailer"
 end
config/environments/production.rb
@@ -63,6 +63,7 @@ Rails.application.configure do
   # Ignore bad email addresses and do not raise email delivery errors.
   # Set this to true and configure the email server for immediate delivery to raise delivery errors.
   # config.action_mailer.raise_delivery_errors = false
+  config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM_ADDRESS') }
 
   # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
   # the I18n.default_locale when a translation cannot be found).
config/environments/test.rb
@@ -20,6 +20,8 @@ Rails.application.configure do
   config.consider_all_requests_local       = true
   config.action_controller.perform_caching = false
 
+  config.action_mailer.default_options = { from: 'from@example.com' }
+
   # Raise exceptions instead of rendering exception templates.
   config.action_dispatch.show_exceptions = false