Reputation: 844
I am using the Kohana PDF Viewer Module (DOMPDF) to dynamically create a PDF file from a HTML page.
I am able to use the Kohana send_file
to view or download the PDF:
// Load a view using the PDF extension
$pdf = View_PDF::factory('Print/Summary');
// Use the PDF as the request response
$response = new Response();
$response->body($pdf);
$filename = 'myfile.pdf';
$response->send_file(TRUE, $filename, array('inline' => TRUE));
I would like to attach this PDF to an e-mail and send but I'm unsure what the best way to get this PDF as I would normally use an uploaded file not a server generated one?
Thanks for help with this.
Upvotes: 0
Views: 1273
Reputation: 9650
You can use swiftmailer to do this: http://swiftmailer.org/docs/messages.html#attaching-dynamic-content
I recommend using Shadowhand's email module which is essentially a wrapper around swiftmailer: https://github.com/shadowhand/email
Upvotes: 1