Home » Mail » Mail_Mime » Bug #549
Mail/mimeDecode fails to decode attachement body
Details
| Submitted | 2004-01-09 01:13 UTC |
|---|---|
| From | ytrewq at cyberspace dot pl |
| Assigned | gschlossnagle |
| Status | Closed |
| Package | Mail_Mime |
| PHP Version | 4.3.4 |
| OS | linux |
| Roadmaps | (Not assigned) |
Comments
[2004-01-09 01:13 UTC] ytrewq at cyberspace dot pl
Description:
------------
With some email messages the Mail/mimeDecode fails to decode the body, other email maessages thad differ only in the attachement body are decoded properly. To get the attachement body from the messages that are decoded properly i have to decode it two times because the enclosed file is somewhat "nested"
I can send the example email that causes the problem.
Reproduce code:
---------------
$params['include_bodies']=true;
$params['decode_bodies']=true;
$params['decode_headers']=true;
$decoder= new Mail_mimeDecode($buffer);
$structure = $decoder->decode($params);
$message['Sender']=$structure->headers['from'];
$message['Destination']=$structure->headers['to'];
$decoder2 = new Mail_mimeDecode($structure->body);
$structure2 = $decoder->decode($params);
print_r($structure2->budy);
Expected result:
----------------
body of the enclosed file
Actual result:
--------------
empty string or body of the enclosed file dependant on the file, the same file is processed the same way (good or bad) every time.
[2004-01-22 22:25 UTC] pear dot bugs at pointb dot co dot uk
I have been having the same issues. The code works fine with a plain text email, but I have been trying to decode a html email sent via outlook express. Every time I get back the following error object:
pear_error Object
(
[error_message_prefix] =>
[mode] => 1
[level] => 1024
[code] =>
[message] => No boundary found for multipart/alternative part
[userinfo] =>
[backtrace] => Array
(
[0] => Array
(
[file] => /usr/local/php/share/pear/PEAR.php
[line] => 528
[function] => pear_error
[class] => pear_error
[type] => ->
[args] => Array
(
[0] => No boundary found for multipart/alternative part
[1] =>
[2] => 1
[3] => 1024
[4] =>
)
)
[1] => Array
(
[file] => /usr/local/php/share/pear/Mail/mimeDecode.php
[line] => 186
[function] => raiseerror
[class] => mail_mimedecode
[type] => ->
[args] => Array
(
[0] => No boundary found for multipart/alternative part
)
)
[2] => Array
(
[file] => /home/richard/websites/bin/stdin.php
[line] => 10
[function] => decode
[class] => mail_mimedecode
[type] => ->
[args] => Array
(
[0] => Array
(
[include_bodies] => 1
[decode_bodies] => 1
[decode_headers] => 1
)
)
)
)
[callback] =>
)
[2004-01-28 00:54 UTC] info at 995soft dot com
In the file "mimeDecode.php", seach for the following string:
"new Mail_mimeDecode($body)"
then replace the line:
"$return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies));"
by:
$return->parts[] = $obj->decode(array(
'include_bodies' => $this->_include_bodies,
'decode_bodies' => $this->_decode_bodies,
'decode_headers' => $this->_decode_headers));
This will ensure that the 'decode_bodies' and 'decode_headers' settings are preserved.
[2004-02-25 18:45 UTC] gschlossnagle at php dot net
This bug has been fixed in CVS.
In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.
In case this was a pear.php.net website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PEAR better.