debian-mirror-gitlab/app/mailers/email_rejection_mailer.rb

28 lines
709 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2020-03-13 15:44:24 +05:30
class EmailRejectionMailer < ApplicationMailer
2019-07-07 11:18:12 +05:30
layout 'empty_mailer'
helper EmailsHelper
2015-09-25 12:07:36 +05:30
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}"
}
2016-04-02 18:10:28 +05:30
headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
2015-09-25 12:07:36 +05:30
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