Sha256: e13fc491df9e0f22381598889d376680dfb870ac78a8e43da8ea8052cf1d3dfc

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module SendGridSmtpApi
  class MailInterceptor
    def self.delivering_email(mail)
      sendgrid_header = mail.instance_variable_get(:@sendgrid_header)
      standard_smtp   = sendgrid_header.instance_variable_get(:@standard_smtp)

      unless standard_smtp
        sendgrid_header.add_recipients(mail.to)
        mail.header['to'] = 'dummy@email.com'
      end
      mail.header['X-SMTPAPI'] = sendgrid_header.to_json if sendgrid_header.data.present?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sendgrid_smtpapi-1.0.1 lib/send_grid/mail_interceptor.rb
sendgrid_smtpapi-1.0.0 lib/send_grid/mail_interceptor.rb
sendgrid_smtpapi-0.0.2 lib/send_grid/mail_interceptor.rb
sendgrid_smtpapi-0.0.1 lib/send_grid/mail_interceptor.rb