Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Doc Bug #18936 Example for Mail_mime not working
Submitted: 2011-10-28 17:52 UTC
From: panamajo Assigned: alec
Status: Closed Package: Mail_Mime (version 1.8.2)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: 1.8.3    
Subscription  


 [2011-10-28 17:52 UTC] panamajo (Jo Schulze)
Description: ------------ The example code here: <http://pear.php.net/manual/en/package.mail.mail-mime.example.php> does not work. This is caused by the use of the undocumented method txtHeaders() instead of the documented headers(). Both return the given headers plus additional headers added by Mail_mime depending on which attachments, HTML body etc have been added before. But txtHeaders() returns them as a string (suitable for the native PHP mail() function, while headers() returns them as array, suitable for Mail::send(). Especially for a n00b no example is better than a broken example. Test script: --------------- Try the example script, just replace the last line with: $rc = $mail->send('user@example.com', $hdrs, $body); if($rc instanceof PEAR_Error) { trigger_error($rc->getMessage()); } else { // do whatever to indicate it worked $mail = TRUE; } Expected result: ---------------- No warning, notice, whatever. Mail sent. Actual result: -------------- $headers must be an array in ... No mail sent.

Comments

 [2011-10-30 12:04 UTC] alec (Aleksander Machniak)
-Status: Open +Status: Closed -Assigned To: +Assigned To: alec
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.