$mail->getFile() obviously reads in a file from the disk. You already have your attachment in memory, so don't call that function. Just do $attachment = $data;
-Rasmus On Sun, 29 Sep 2002, Jonas Geiregat wrote: > this is my code what I want to do is > generate a pdf file(not save it on hd of server but in memory) > then send it as attachement to someone > > $pdf = pdf_new(); > > pdf_open_file($pdf,""); > pdf_begin_page($pdf, 595, 842); > pdf_set_font($pdf, "Times-Roman", 30, "host"); > pdf_set_value($pdf, "textrendering", 1); > pdf_show_xy($pdf, "A PDF document created in memory!", 50, >750); > pdf_end_page($pdf); > pdf_close($pdf); > $data = pdf_get_buffer($pdf); > > > /** > * Filename.......: example.3.php > * Project........: HTML Mime Mail class > * Last Modified..: 15 July 2002 > */ > error_reporting(E_ALL); > include('htmlMimeMail.php'); > > /** > * Example of usage. This example shows > * how to use the class to send a plain > * text email with an attachment. No html, > * or embedded images. > * > * Create the mail object. > */ > $mail = new htmlMimeMail(); > > /** > * Read the file test.zip into $attachment. > */ > $attachment = $mail->getFile('test.pdf'); > > /** > * Since we're sending a plain text email, > * we only need to read in the text file. > */ > $text = $mail->getFile('example.txt'); > > /** > * To set the text body of the email, we > * are using the setText() function. This > * is an alternative to the setHtml() function > * which would obviously be inappropriate here. > */ > $mail->setText($text); > > /** > * This is used to add an attachment to > * the email. > */ > $mail->addAttachment($attachment, 'test.pdf', 'application/zip'); > > /** > * Sends the message. > */ > $mail->setFrom('Joe <[EMAIL PROTECTED]'); > $result = $mail->send(array('"Richard" <[EMAIL PROTECTED]>')); > > echo $result ? 'Mail sent!' : 'Failed to send mail'; > > > the mail get's send but I get this error > Warning: fopen("test.pdf", "rb") - No such file or directory in > /home/web/intranet/httpdocs/htmlMimeMail.php on line 162 > and test.pdf is included in the mail but is 0kb big > anyone sees the prob ? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php