pdfshop/app/mailers/order_mailer.rb

32 lines
996 B
Ruby

# Order Mailer
class OrderMailer < ApplicationMailer
default to: 'kaktusiarnia@kaktusiarnia.pl'
def new_order(order)
@order = order
ss = ScSetting.first
mail(subject: 'Potwierdzenie złożenia zamówienia na kaktusiarnia.pl',
from: "#{ss.shop_name} <kaktusiarnia.rumia@gmail.com>",
to: @order.email)
end
def new_order_to_shop_owner(order)
@order = order
ss = ScSetting.first
otp = OrderToPdf.new(@order)
attachments[otp.file_name] = otp.call
sleep(5) # to make sure pdf file saved on the disk
mail(subject: "Nowe zamówienie nr: #{@order.beauty_id}",
from: "#{ss.shop_name} <kaktusiarnia.rumia@gmail.com>",
to: ss.shop_owners_emails,
reply_to: @order.email)
end
def status_change(order)
@order = order
ss = ScSetting.first
mail(subject: "Zmiana statusu zamówienia #{@order.beauty_id}",
from: "#{ss.shop_name} <kaktusiarnia.rumia@gmail.com>",
to: @order.email)
end
end