From a5c34275c0909c59ac9cafe3b40f37cd597e1434 Mon Sep 17 00:00:00 2001 From: Daniel Perrett Date: Thu, 7 Nov 2024 10:30:23 +0000 Subject: [PATCH] chore: set mailer 'from', which may differ from username --- app/mailers/application_mailer.rb | 2 +- config/environments/production.rb | 5 +++++ config/environments/staging.rb | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 4c03101..673b787 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,4 @@ class ApplicationMailer < ActionMailer::Base - default from: ENV["MAILER_USERNAME"] + default from: ENV["MAILER_FROM"] layout 'mailer' end diff --git a/config/environments/production.rb b/config/environments/production.rb index 013a963..38b3f39 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,6 +73,11 @@ password: ENV["MAILER_PASSWORD"] } + config.action_mailer.default_options = { + from: mailer_credentials[:from], + reply_to: mailer_credentials[:from] + } + # 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 diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 013a963..38b3f39 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -73,6 +73,11 @@ password: ENV["MAILER_PASSWORD"] } + config.action_mailer.default_options = { + from: mailer_credentials[:from], + reply_to: mailer_credentials[:from] + } + # 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