Solved

can attach a dynamic pdf file to a mail?

Posted on 2008-10-27
4
543 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
Comment Utility
yes, use a proper php mailer class:

http://phpmailer.sourceforge.net
0
 

Author Comment

by:denny3d
Comment Utility
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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now