Class: EmailRejectionMailer

Inherits:
BaseMailer
  • Object
show all
Defined in:
app/mailers/email_rejection_mailer.rb

Instance Attribute Summary

Attributes inherited from BaseMailer

#current_user

Instance Method Summary collapse

Methods inherited from BaseMailer

#can?

Instance Method Details

#rejection(reason, original_raw, can_retry = false) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/mailers/email_rejection_mailer.rb', line 2

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