Merge pull request #4148 from tgxworld/dont_reply_to_emails_that_are_autogenerated

FIX: Don't send rejection mailer to bounced emails.
This commit is contained in:
Régis Hanol
2016-04-13 15:36:14 +02:00
10 changed files with 188 additions and 13 deletions

View File

@ -17,6 +17,9 @@ module Email
class MessageBuilder
attr_reader :template_args
REPLY_TO_AUTO_GENERATED_HEADER_KEY = "X-Discourse-Reply-to-Auto-Generated".freeze
REPLY_TO_AUTO_GENERATED_HEADER_VALUE = "marked".freeze
def initialize(to, opts=nil)
@to = to
@opts = opts || {}
@ -132,7 +135,11 @@ module Email
def header_args
result = {}
if @opts[:add_unsubscribe_link]
result['List-Unsubscribe'] = "<#{template_args[:user_preferences_url]}>" if @opts[:add_unsubscribe_link]
result['List-Unsubscribe'] = "<#{template_args[:user_preferences_url]}>"
end
if @opts[:mark_as_reply_to_auto_generated]
result[REPLY_TO_AUTO_GENERATED_HEADER_KEY] = REPLY_TO_AUTO_GENERATED_HEADER_VALUE
end
result['X-Discourse-Post-Id'] = @opts[:post_id].to_s if @opts[:post_id]