Class: Spree::CartonMailer

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

Instance Method Summary collapse

Methods inherited from BaseMailer

#bcc_address, #from_address, #mail, #money

Instance Method Details

#shipped_email(options) ⇒ Mail::Message

Send an email to customers to notify that an individual carton has been shipped. If a carton contains items from multiple orders then this will be called with that carton one time for each order.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • carton (Spree::Carton)

    the shipped carton

  • order (Spree::Order)

    one of the orders with items in the carton

  • resend (Boolean)

    indicates whether the email is a ‘resend’ (e.g. triggered by the admin “resend” button)

Returns:

  • (Mail::Message)


14
15
16
17
18
19
20
21
22
23
# File 'app/mailers/spree/carton_mailer.rb', line 14

def shipped_email(options)
  @order = options.fetch(:order)
  @carton = options.fetch(:carton)
  @manifest = @carton.manifest_for_order(@order)
  options = { resend: false }.merge(options)
  @store = @order.store
  subject = (options[:resend] ? "[#{t('spree.resend').upcase}] " : '')
  subject += "#{@store.name} #{t('spree.shipment_mailer.shipped_email.subject')} ##{@order.number}"
  mail(to: @order.email, from: from_address(@store), subject: subject)
end