createPDF and attach to mail script
4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 27, 2011 (RSS)
By rjbathgate - July 27, 2011
I have a send to mail script which currently handles uploaded files (uploaded via the form) (attaches to email sent).
I now want to be able to create a PDF of a record (using createPDF_display('attachment', $data, $fileName); or similar) and make it available to attach to an the email.
So, I think I need to use the createPDF function to create the PDF in a temp folder on the server, but NOT offer it to the user (i.e. no attachment or inline), and then return this temp file path, so I can update my mail script to do attach it.
So, I guess my question is, how do I use the createPDF function to save a pdf into a temp folder, but NOT return anything to the front end user, and to return to a variable the file path of said created pdf?
Cheers!
Rob
Re: [rjbathgate] createPDF and attach to mail script
By Toledoh - July 27, 2011
Tim (toledoh.com.au)
Re: [Toledoh] createPDF and attach to mail script
By rjbathgate - July 27, 2011
Have a look at http://www.interactivetools.com/iforum/Products_C2/CMS_Builder%3A_Plugins_%26_Add-ons_F40/gforum.cgi?post=86741 - hpefully it helps...
Boom!!!
Thank you :)
Re: [rjbathgate] createPDF and attach to mail script
By rjbathgate - July 27, 2011 - edited: July 27, 2011
Got it working attaching both a pdf generated on the fly and an uploaded file via form.
if (is_uploaded_file(@$coverletter)) {
$fileb = fopen($coverletter,"rb");
$datab = fread($fileb,filesize($coverletter));
fclose($fileb);
}
sendMessage(array(
'from' => $EmailFrom,
'to' => $EmailTo,
'subject' => $Subject,
'text' => $Body,
'attachments' => array(
$cv_name => $data,
$coverletter_name => $datab
)
));
Thanks!