summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-10-01 01:44:50 -0700
committerRobert Speicher <rspeicher@gmail.com>2015-10-05 13:58:43 -0400
commit11cc2cd221dcb45ececbea33d8a4d779c92ec35f (patch)
tree4ecec0fc757d3ddbbb9ce71cd970e5fe070b9764
parentf9a0c22d263d30d20be79de7a0cf5fcccb602f4e (diff)
downloadgitlab-ce-11cc2cd221dcb45ececbea33d8a4d779c92ec35f.tar.gz
Fix Message-ID field to be RFC 2111-compliant to prevent e-mails from being dropped
Closes #2867
-rw-r--r--CHANGELOG3
-rw-r--r--app/mailers/notify.rb2
-rw-r--r--spec/mailers/notify_spec.rb1
3 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index baa4cebb61e..a392254b53e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
Please view this file on the master branch, on stable branches it's out of date.
+v 8.0.4
+ - Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
+
v 8.0.3
- Fix URL shown in Slack notifications
- Fix bug where projects would appear to be stuck in the forked import state (Stan Hu)
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index db2f9654e14..50a409c3754 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -140,7 +140,7 @@ class Notify < BaseMailer
# * have a 'In-Reply-To' or 'References' header that references the original 'Message-ID'
#
def mail_answer_thread(model, headers = {})
- headers['Message-ID'] = SecureRandom.hex
+ headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
headers['In-Reply-To'] = message_id(model)
headers['References'] = message_id(model)
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 2c97a521d96..f219af67ffe 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -52,6 +52,7 @@ describe Notify do
end
it 'has headers that reference an existing thread' do
+ is_expected.to have_header 'Message-ID', /<(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'References', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'In-Reply-To', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'X-GitLab-Project', /#{project.name}/