Bug #16033 [Opn->Fbk]: PDF attachments not getting through

From: Date: Fri, 20 Mar 2009 15:35:22 +0000
Subject: Bug #16033 [Opn->Fbk]: PDF attachments not getting through
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-208@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=16033&edit=1 ID: 16033 Updated by: till@php.net Reported By: ken at linux dot ie Summary: PDF attachments not getting through -Status: Open +Status: Feedback Type: Bug Package: Mail_Queue Operating System: Ubuntu 8.10 Package Version: 1.2.2 PHP Version: 5.2.5 Roadmap Versions: New Comment: -Status: Open +Status: Feedback Dear Ken, :D can you verify that the content-type returned for the PDF is correct? Also, just to double-check -- did attaching PDFs work with PEAR::Mail on your system? Best regards, Till Previous Comments: ------------------------------------------------------------------------ [2009-03-13 14:50:48] kguest Description: ------------ Emails stored with PDF attachments are not received properly. gifs and jpegs are. Attached gifs & jpegs are received and displayed fine by the email client - but no indication of PDF being included in the email received. This is using the same schema as given in the tutorial - but changing the body field to a blob. Test PDF is approx 591K in size. I amended the code to not use Mail_Queue but the Mail package instead to determine where the problem lies - and those tests worked fine with the result of attached PDFs being received without error. Test code is as below. A 'cleansed' version of the debug output (simple search & replaces to protect the innocent re host & address details), from the conversation with the mail server, is as follows: DEBUG: Recv: 220 mail.example.com ESMTP Postfix (Debian/GNU) DEBUG: Send: EHLO localhost DEBUG: Recv: 250-mail.example.com DEBUG: Recv: 250-PIPELINING DEBUG: Recv: 250-SIZE 10240000 DEBUG: Recv: 250-VRFY DEBUG: Recv: 250-ETRN DEBUG: Recv: 250-STARTTLS DEBUG: Recv: 250-ENHANCEDSTATUSCODES DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250 DSN DEBUG: Send: MAIL FROM:<joe@example.com> DEBUG: Recv: 250 2.1.0 Ok DEBUG: Send: RCPT TO:<joe@example.com> DEBUG: Recv: 250 2.1.5 Ok DEBUG: Send: DATA DEBUG: Recv: 354 End data with <CR><LF>.<CR><LF> DEBUG: Send: MIME-Version: 1.0 From: joe@example.com To: joe@example.com Subject: test subject Content-Type: multipart/mixed; boundary="=_317984f24d0a675ae6b7bc4fb850008f" . DEBUG: Recv: 250 2.0.0 Ok: queued as 9913633C30B DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 Bye Test script: --------------- in insert.php: include 'Mail/Queue/Container/mdb2.php'; include 'Mail/Queue/Container.php'; include 'Mail/Queue.php'; define('DB_HOST', 'localhost'); define('DB_NAME', 'testdb'); define('DB_PASS', ''); define('DB_USER', 'root'); $db_options['dsn'] = 'mysqli://'.DB_USER.':'.DB_PASS.'@'.DB_HOST.'/'.DB_NAME; $db_options['mail_table'] = 'mail_queue'; $db_options['type'] = 'mdb2'; $mail_options['driver'] = 'smtp'; $mail_options['host'] = 'mail.example.com'; $mail_options['port'] = 25; $mail_options['localhost'] = 'localhost'; $mail_options['auth'] = false; $mail_options['debug'] = false; $mail_queue =& new Mail_Queue($db_options, $mail_options); $file= '/home/ken/Desktop/PHPWhitePaper.pdf'; $mimetype = mime_content_type($file); $from = 'joe@example.com'; $to = "joe@example.com"; $message = "Hi! This is test message!! :)\n{$mimetype}"; $hdrs = array( 'From' => $from, 'To' => $to, 'Subject' => "test subject" ); /* we use Mail_mime() to construct a valid mail */ $mime = new Mail_mime(); $mime->setTXTBody($message); $mime->setHTMLBody("<html><body><b>$message</b></body></html>"); $mime->addAttachment($file, $mimetype); $body = $mime->get(); $hdrs = $mime->headers($hdrs); /* Put message to queue */ $mail_queue->put($from, $to, $hdrs, $body); in flush.php: include 'Mail/Queue.php'; include 'Mail/Queue/Container.php'; include 'Mail/Queue/Container/mdb2.php'; define('DB_HOST', 'localhost'); define('DB_USER', 'root'); define('DB_PASS', ''); define('DB_NAME', 'testdb'); $db_options['type'] = 'mdb2'; $db_options['dsn'] = 'mysqli://'.DB_USER.':'.DB_PASS.'@'.DB_HOST.'/'.DB_NAME; $db_options['mail_table'] = 'mail_queue'; $mail_options['driver'] = 'smtp'; $mail_options['host'] = 'mail.example.com'; $mail_options['port'] = 25; $mail_options['localhost'] = 'localhost'; //optional Mail_smtp parameter $mail_options['auth'] = false; $mail_options['debug'] = true; /* How many mails could we send each time the script is called */ $max_amount_mails = 50; /* we use the db_options and mail_options from the config again */ $mail_queue =& new Mail_Queue($db_options, $mail_options, 0 , false); /* really sending the messages */ $dn = $mail_queue->sendMailsInQueue($max_amount_mails); if (!$dn === true) { var_dump($dn); } Expected result: ---------------- Email to which PDF is attached should be received with the attachment intact. Actual result: -------------- Viewing source of the email shows no reference to intended attachment. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=16033&edit=1

« previous php.pear.bugs (#208) next »