Class: SendGrid::MailInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/send_grid/mail_interceptor.rb

Class Method Summary collapse

Class Method Details

.delivering_email(mail) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/send_grid/mail_interceptor.rb', line 3

def self.delivering_email(mail)
  sendgrid_header = mail.instance_variable_get(:@sendgrid_header)
  sendgrid_header.add_recipients(mail.to)
  sendgrid_header.add_recipients(mail.cc)
  sendgrid_header.add_recipients(mail.bcc)
  mail.header['X-SMTPAPI'] = sendgrid_header.to_json if sendgrid_header.data.present?
  mail.header['to'] = SendGrid.config.dummy_recipient
end