?
Solved

can attach a dynamic pdf file to a mail?

Posted on 2008-10-27
4
Medium Priority
?
559 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 1500 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 111

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

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

771 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