Solved

can attach a dynamic pdf file to a mail?

Posted on 2008-10-27
4
551 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 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 110

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

728 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