From 5466b39c78e0c97a9db6377eefa4c3ce44dc1514 Mon Sep 17 00:00:00 2001
From: Hugo Gameiro <hmgameiro@gmail.com>
Date: Mon, 2 Sep 2019 17:12:40 +0100
Subject: [PATCH] Add SMTP reply_to option (#11718)

* Add SMTP_REPLY_TO in .env.production.sample

* Set reply_to in SMTP options
---
 .env.production.sample            | 1 +
 config/environments/production.rb | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.env.production.sample b/.env.production.sample
index d66b050509..b322aee1d7 100644
--- a/.env.production.sample
+++ b/.env.production.sample
@@ -69,6 +69,7 @@ SMTP_PORT=587
 SMTP_LOGIN=
 SMTP_PASSWORD=
 SMTP_FROM_ADDRESS=notifications@example.com
+#SMTP_REPLY_TO=
 #SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
 #SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail
 #SMTP_AUTH_METHOD=plain
diff --git a/config/environments/production.rb b/config/environments/production.rb
index d1b5a8df54..29d6194dda 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -83,7 +83,10 @@ Rails.application.configure do
   config.action_mailer.perform_caching = false
 
   # E-mails
-  config.action_mailer.default_options = { from: ENV.fetch('SMTP_FROM_ADDRESS', 'notifications@localhost') }
+  config.action_mailer.default_options = {
+    from: ENV.fetch('SMTP_FROM_ADDRESS', 'notifications@localhost'),
+    reply_to: ENV['SMTP_REPLY_TO']
+  }
 
   config.action_mailer.smtp_settings = {
     :port                 => ENV['SMTP_PORT'],
-- 
GitLab