Module: SendgridNotification::MailRecordable

Included in:
NullMailer, SendgridMailer
Defined in:
app/models/sendgrid_notification/mail_recordable.rb

Instance Method Summary collapse

Instance Method Details

#sendmail(to, notification_mail, parmas, attachments = []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/sendgrid_notification/mail_recordable.rb', line 4

def sendmail(to, notification_mail, parmas, attachments = [])
  result = super

  m = MailHistory.new(
    key: notification_mail.key,
    to: to,
    sent_at: Time.now,
  )
  m.attachment_summary = attachment_summary(attachments) if m.respond_to?(:attachment_summary=)
  m.save
  Rails.logger.error m.errors.full_messages if m.invalid? # and ignore

  result
end