|
![Picture of Steve Nagy Picture of Steve Nagy](/graphics/unknown.gif) Steve Nagy - 2014-11-03 18:12:49
Hi,
First off, this is a great package and we love using it.
We currently send messages with a pdf attachment generated with HTML2PDF. The file is written to a temp directory and then this file is added to the e-mail message. Is it possible to create an attachment part directly from the contents of a PHP variable an, if so, how?
Thanks,
Steve Nagy
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2014-11-03 22:24:08 - In reply to message 1 from Steve Nagy
Sure, when you call AddFilePart, you can pass the parameters array with an entry named Data that should pass the string of content data of your file.
![Picture of Steve Nagy Picture of Steve Nagy](/graphics/unknown.gif) Steve Nagy - 2014-11-03 22:49:30 - In reply to message 2 from Manuel Lemos
Hi Manuel,
Just to be sure, there would be no file, just a variable containing a pdf image. What would the array look like?
Thanks,
Steve
![Picture of Manuel Lemos Picture of Manuel Lemos](/picture/user/1.jpg) Manuel Lemos - 2014-11-04 04:52:55 - In reply to message 3 from Steve Nagy
It could be something like this:
$part = array(
'Data'=>$pdf_data,
'Name'=>'some-document.pdf',
'Content-Type'=>'application/pdf'
);
![Picture of Steve Nagy Picture of Steve Nagy](/graphics/unknown.gif) Steve Nagy - 2014-11-04 14:33:15 - In reply to message 4 from Manuel Lemos
Worked like a charm. Thanks Manuel!
|