Herokuで(およびローカルで開発用に)PDFKitを使用していますが、cronタスクから生成されたPDFを電子メールで送信するのに問題があります。
これは私のcronジョブのコードです:
kit = PDFKit.new(html_file)
file = kit.to_pdf
OutboundMailer.deliver_pdf_email(file)
#kit.render_file("pdf_from_cron.pdf")
これは私のメーラーのコードです:
def pdf_email(pdf)
subject "This is your batch of letters"
recipients "helloworld@gmail.com"
from "Batch Email <hello@batch.com>"
sent_on Date.today
body "This is the body of pdf"
attachment "application/pdf" do |a|
a.filename = "batch-letters.pdf"
a.body = pdf
end
end