BigW Consortium Gitlab

email_rejection_mailer.rb 623 Bytes
Newer Older
1
class EmailRejectionMailer < BaseMailer
2 3 4 5
  def rejection(reason, original_raw, can_retry = false)
    @reason = reason
    @original_message = Mail::Message.new(original_raw)

6 7
    return unless @original_message.from

8 9 10 11 12
    headers = {
      to: @original_message.from,
      subject: "[Rejected] #{@original_message.subject}"
    }

13
    headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
14 15 16 17 18 19 20 21
    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