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

Bug #44 Malformed attachement encoding
Submitted: 2003-09-29 16:01 UTC
From: mp at icomme dot fr Assigned:
Status: Bogus Package: Mail_Mime
PHP Version: 4.3.3 OS: Win2k
Roadmaps: (Not assigned)    
Subscription  


 [2003-09-29 16:01 UTC] mp at icomme dot fr
Description: ------------ PHP 4.3.3 win32 Win 2K Server (french) PEAR package : Mail_Mime 1.2.1 When trying the basic Mail_Mime example from the manual : http://pear.php.net/manual/en/package.mail.mail-mime.example.php It returns me an email with a malformed attachement : starting of attachement is good, but the end isn't. Note that if the "$html" variable content is longer, the portion of attachement with is NOT malformed is shorter. Reproduce code: --------------- include('Mail.php'); include('Mail/mime.php'); $text = 'Text version of email'; $html = '<html><body>HTML version of email</body></html>'; $file = 'blabla.txt'; $crlf = "\r\n"; $hdrs = array( 'From' => 'webmaster@sleepingatwork.org', 'Subject' => 'Test mime message' ); $mime = new Mail_mime($crlf); $mime->setTXTBody($text); $mime->setHTMLBody($html); $mime->addAttachment($file, 'text/plain'); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mail =& Mail::factory('mail'); $mail->send('me@myself.com', $hdrs, $body); Expected result: ---------------- Expected attachement in the message sent by Mime_Mail : (a 1522 char/bytes long file with 3 x 11 lines of 44 chars + 1 blank line between each paragraphs) Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. (etc...) Actual result: -------------- Actual attachement in the message : Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. Bla bla bla bla bla bla bla bla bla bla bla. ›H›H›H›H›H›H›H›H›H›H›KƒB›H›H›H›H›H›H›H›H›H›H›KƒB›H›H› (etc... 1245 bytes long trash-style text)

Comments

 [2003-09-29 16:03 UTC] mp at icomme dot fr
"...the portion of attachement with is NOT malformed is shorter." should be read "...which is NOT malformed..."
 [2003-10-18 09:54 UTC] heino at php dot net
Worked fine - could NOT reproduce the bug on PHP4.3.3 on Debian GNU/Linux. Could someone try it on Windows2000...
 [2003-12-10 23:24 UTC] brad dot harder at vettweb dot net dot au
Looks like this issue has been around for a while, but I can reproduce the bug on PHP 4.3.3 Win2K I used the example code from the documentation, attempting to send an image file, a Word document, and a text file. The text file came out glarbled with "trash-style text". I also attempted to send an attachment using mimePart, with similar results. The only exception was I changed the encoding for the text file from the default base64 to 7bit and it was successful. This leads me to think that it might be something in the base64 encoding?
 [2003-12-10 23:28 UTC] brad dot harder at vettweb dot net dot au
"I used the example code from the documentation, attempting to send an image file, a Word document, and a text file." Forgot to mention that was using mail_mime, and that the other attachments did not open and were not recognised as their particular file types. The best result that I had was using mimePart, the image file was at least recognised as being an image and was partially displayed when loaded.
 [2004-01-15 09:55 UTC] mp at icomme dot fr
GOOD NEWS ! It seems that upgrading PHP from 4.3.3 to 4.3.4 resolve this problem. Above example and all test I've done works perfect with PHP 4.3.4.
 [2006-12-23 20:26 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!