This topic is locked

Email pdf attachment

7/30/2014 11:23:35 AM
PHPRunner General questions
C
cms001 author

Hi,
does anyone have an example of how to generate/convert a report in pdf format, attach it to an email and send it to customer ?
I have been trying various help files, but no real solutions as yet.
Thanks very much.

C
cms001 author 7/30/2014

I have found this, to email an attachment, but how do I create the attachment from the report ?:
Send email with attachments:

$from = "myemail@test.com";
$to = "myclient@test.com";
$msg = "Find some documents (Invoice.pdf, Photo.jpg, signature.jpg) attached.";
$subject="Documents";

$attachments = array();
// Attachments description. The 'path'(a path to the attachment) is required. Others parameters are optional:
//'name' overrides the attachment name, 'encoding' sets a file encoding, 'type' sets a MIME type
$attachments = array(
array('path' => getabspath('files/Invoice.pdf')),
array('path' => getabspath('files/Photo12.jpg'),
'name' => 'Photo.jpg',
'encoding' => 'base64',
'type' => 'application/octet-stream'),
array('path' => getabspath('files/signature.jpg'))
) ;

$ret = runner_mail(array('from' => $from, 'to' => $to, 'subject' => $subject, 'body' => $msg, 'attachments' => $attachments));

if(!$ret["mailed"]){
echo $ret["message"];
}
lefty 7/30/2014

See this link in asp forum but it is for php . As asp is extremely hard to do this. You can generate pdf view but will not look like report . You need to format the pdf in an event . That is the only way I have ever found to work with PHP runner. Will not work with ASP runner. See tedwider user info below. See Output different variables for ouput one is save one is output to screen. You have to attach save to output in email ( that is the problem I still have , I get memory errors . but this is close as I got.
See Link below.
www.asprunner.com/forums/topic/13259-generate-pdf-as-an-attachment-in-an-event/
See FPDF.ORG for more details.