Class: Dorsale::BillingMachine::InvoiceMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/dorsale/billing_machine/invoice_mailer.rb

Instance Method Summary collapse

Instance Method Details

#send_invoice_to_customer(invoice, subject, body, sender = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/mailers/dorsale/billing_machine/invoice_mailer.rb', line 4

def send_invoice_to_customer(invoice, subject, body, sender = nil)
  return false if invoice.try(:customer).try(:email).blank?

  attachments["#{Invoice.t}_#{invoice.tracking_id}.pdf"] = invoice.pdf.render

  mail(
    :to       => invoice.customer.email,
    :cc       => sender.try(:email),
    :reply_to => sender.try(:email),
    :subject  => subject,
    :body     => body,
  )
end