diff --git a/CHANGELOG b/CHANGELOG index 259e1a30072ae980dd6ad1b545e4285077bfcb9f..1810d20117be4d7cdc9c73e7e6dd8406e8b3e38a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 7.10.0 (unreleased) + - Add ability to configure Reply-To address in gitlab.yml (Stan Hu) - Fix broken side-by-side diff view on merge request page (Stan Hu) - Set Application controller default URL options to ensure all url_for calls are consistent (Stan Hu) - Allow HTML tags in Markdown input diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 8fcdd3bc8534ac254f19aea28c492a904f1c962f..0c186ab586647062169ebcf619c6e522dcb31f93 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -19,7 +19,7 @@ class Notify < ActionMailer::Base default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root default from: Proc.new { default_sender_address.format } - default reply_to: "noreply@#{Gitlab.config.gitlab.host}" + default reply_to: Gitlab.config.gitlab.email_reply_to # Just send email with 2 seconds delay def self.delay diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 760a589d6e23892431ef2f173779d96bb83238c0..3d91b67e748301fe17a2f5a1cae65760420ad62c 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -49,6 +49,7 @@ production: &base # Email address used in the "From" field in mails sent by GitLab email_from: example@example.com email_display_name: GitLab + email_reply_to: noreply@example.com # Email server smtp settings are in config/initializers/smtp_settings.rb.sample diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 15c1ae9466f2cf33c43875212c48da031ee3f2b9..fb2dddf2c992e265b0d7495180d0ba9abfb0481f 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -103,6 +103,7 @@ Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].nil? Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" Settings.gitlab['email_display_name'] ||= "GitLab" +Settings.gitlab['email_reply_to'] ||= "noreply@#{Settings.gitlab.host}" Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) Settings.gitlab['user'] ||= 'git' Settings.gitlab['user_home'] ||= begin diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index ba42f9e5c706589e144dac1f0f1b69dc96665ed0..7c4235ab379e53c809ef42c430ea0229e000db2c 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -7,9 +7,12 @@ describe Notify do let(:gitlab_sender_display_name) { Gitlab.config.gitlab.email_display_name } let(:gitlab_sender) { Gitlab.config.gitlab.email_from } + let(:gitlab_sender_reply_to) { Gitlab.config.gitlab.email_reply_to } let(:recipient) { create(:user, email: 'recipient@example.com') } let(:project) { create(:project) } + around(:each) { ActionMailer::Base.deliveries.clear } + before(:each) do email = recipient.emails.create(email: "notifications@example.com") recipient.update_attribute(:notification_email, email.email) @@ -27,6 +30,11 @@ describe Notify do expect(sender.display_name).to eq(gitlab_sender_display_name) expect(sender.address).to eq(gitlab_sender) end + + it 'has a Reply-To address' do + reply_to = subject.header[:reply_to].addresses + expect(reply_to).to eq([gitlab_sender_reply_to]) + end end shared_examples 'an email starting a new thread' do |message_id_prefix|