Solved

can attach a dynamic pdf file to a mail?

Posted on 2008-10-27
4
548 Views
Last Modified: 2008-11-03
hello Expert
I use this free class for create a pdf file with php
http://www.ros.co.nz/pdf/

I have a question :
I generate a dynamic pdf file and when i create it i send a mail to ppppp@ppp.com,
but
Can i attach this dynamic pdf file to a mail?

Tks
0
Comment
Question by:denny3d
4 Comments
 
LVL 17

Expert Comment

by:psimation
ID: 22812209
yes, use a proper php mailer class:

http://phpmailer.sourceforge.net
0
 

Author Comment

by:denny3d
ID: 22812278
ok, for class php mailer, but how i attach my pdf file?
i dont have a phisical pdf file, bu i have a file php that create a temp pdf file.
0
 
LVL 9

Accepted Solution

by:
absx earned 500 total points
ID: 22812742
Hi denny3d,

The easiest way to accomplish this is to find a way to save the generated PDF to a file (with preferably a random file name), then attach this file to the email for sending and finally delete the file. At least the Cpdf class you mention here does write PDF to file, as described in http://www.ros.co.nz/pdf/faq.php#4 .

Using a temporary file saves you having to merge the PDF generating class and the email sending class together to transfer the PDF stream to an attachment.

Hope this helps.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 22821766
I have done this with fpdf -

First, you generate the PDF file and save it in a temporary directory.
Next, you generate the email message, adding the PDF file as an attachment
You send the message, checking the return code from mail()
Then you unlink the PDF.

Man pages here are helpful:
http://www.zend.com/zend/spotlight/sendmimeemailpart1.php
http://pear.php.net/package/Mail_Mime

HTH, ~Ray
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question