gitlab-org--gitlab-foss/app/mailers/email_rejection_mailer.rb
Warren Guy a1e1e72375 Generate valid Message-ID in email rejection mailer
Use a Message-ID that is RFC 2111 compliant. This fix is consistent with
how the Message-ID is generated in the 'notify' mailer.
2016-01-30 18:30:53 +08:00

21 lines
623 B
Ruby

class EmailRejectionMailer < BaseMailer
def rejection(reason, original_raw, can_retry = false)
@reason = reason
@original_message = Mail::Message.new(original_raw)
return unless @original_message.from
headers = {
to: @original_message.from,
subject: "[Rejected] #{@original_message.subject}"
}
headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
headers['In-Reply-To'] = @original_message.message_id
headers['References'] = @original_message.message_id
headers['Reply-To'] = @original_message.to.first if can_retry
mail(headers)
end
end