internetee-registry/app/mailers/invoice_mailer.rb
Artur Beljajev 1c2407a6e9 Remove legacy test emails
Removes `whitelist_emails_for_staging` setting.

Closes #201
2019-04-07 15:18:27 +03:00

16 lines
412 B
Ruby

class InvoiceMailer < ApplicationMailer
include Que::Mailer
def invoice_email(invoice_id, html, billing_email)
@invoice = Invoice.find_by(id: invoice_id)
billing_email ||= @invoice.billing_email
return unless @invoice
kit = PDFKit.new(html)
pdf = kit.to_pdf
invoice = @invoice
attachments[invoice.pdf_name] = pdf
mail(to: format(billing_email), subject: invoice)
end
end