Class: MoteSMS::ActionMailerSMSMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/mote_sms/transports/action_mailer_transport.rb

Overview

Internal: ActionMailer class to forward SMS to recipient.

Instance Method Summary collapse

Instance Method Details

#forward_sms(recipient, sms, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/mote_sms/transports/action_mailer_transport.rb', line 6

def forward_sms(recipient, sms, options = {})
  subject = options[:subject].presence || "SMS to #{sms.to.map(&:to_s).join(', ')}"
  from = options[:from].presence || "#{sms.from} <#{recipient}>"
  mail options.merge(to: recipient, from: from, subject: subject, body: sms.body)
end