2015-08-19 15:35:08 -04:00
|
|
|
class EmailRejectionMailer < BaseMailer
|
2015-08-19 14:10:21 -04:00
|
|
|
def rejection(reason, original_raw, can_retry = false)
|
|
|
|
@reason = reason
|
|
|
|
@original_message = Mail::Message.new(original_raw)
|
|
|
|
|
2015-08-24 13:57:35 -04:00
|
|
|
return unless @original_message.from
|
|
|
|
|
2015-08-19 14:10:21 -04:00
|
|
|
headers = {
|
|
|
|
to: @original_message.from,
|
|
|
|
subject: "[Rejected] #{@original_message.subject}"
|
|
|
|
}
|
|
|
|
|
2016-01-30 05:30:51 -05:00
|
|
|
headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
|
2015-08-19 14:10:21 -04:00
|
|
|
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
|