A platform for community discussion. Free, open, simple.
FIX: Remove List-Unsubscribe header if using group SMTP (#13448)
Martin Brennanf0c10edd2813
diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rbindex a63c7b14477..7f8ce6f5f62 100644--- a/app/mailers/user_notifications.rb+++ b/app/mailers/user_notifications.rb@@ -492,6 +492,7 @@ class UserNotifications < ActionMailer::Basefrom_address = nildelivery_method_options = niluse_from_address_for_reply_to = false+ using_group_smtp = falsetemplate = +"user_notifications.user_#{notification_type}"if post.topic.private_message?@@ -562,6 +563,7 @@ class UserNotifications < ActionMailer::Base# will forward the email back into Discourse and process/link it correctly.use_from_address_for_reply_to = truefrom_address = group.email_username+ using_group_smtp = trueendif post.topic.private_message?@@ -711,7 +713,8 @@ class UserNotifications < ActionMailer::Baselocale: locale,delivery_method_options: delivery_method_options,use_from_address_for_reply_to: use_from_address_for_reply_to,- from: from_address+ from: from_address,+ add_unsubscribe_link: !using_group_smtp}unless translation_override_existsdiff --git a/spec/components/email/sender_spec.rb b/spec/components/email/sender_spec.rbindex 27e93515afa..3c56e932443 100644--- a/spec/components/email/sender_spec.rb+++ b/spec/components/email/sender_spec.rb@@ -375,6 +375,7 @@ describe Email::Sender doexpect(message.header['List-Post']).to eq(nil)expect(message.header['List-Archive']).to eq(nil)expect(message.header['Precedence']).to eq(nil)+ expect(message.header['List-Unsubscribe']).to eq(nil)endendend