PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_mimeDecode » Bug #5831

Mail_MimeDecode: No boundary found for multipart/mixed part [FIX]

Details

Submitted2005-10-31 13:04 UTC
Fromcm at data-consult dot de
StatusDuplicate
PackageMail_mimeDecode
PHP Version4.3.10
OSdebian sarge
Roadmaps(Not assigned)

Comments

[2005-10-31 13:04 UTC] cm at data-consult dot de

Description:
------------
mimeDecode cant decode this special mail.
i have it running now for an webmail incoming adapter that decodes all incoming mail.(and it does that very well i must admit)
now i got a mail here mimedecode is unable to decode.

errormessage is :
No boundary found for multipart/mixed part
but as you can see below, the boundary is defined in the header and exists where it should be.

Actual result:
--------------
pear_error Object
(
[error_message_prefix] =>
[mode] => 1
[level] => 1024
[code] =>
[message] => No boundary found for multipart/mixed part
[userinfo] =>
[backtrace] => Array
(
[0] => Array
(
[file] => /usr/share/php/PEAR.php
[line] => 539
[function] => pear_error
[class] => pear_error
[type] => ->
[args] => Array
(
[0] => No boundary found for multipart/mixed part
[1] =>
[2] => 1
[3] => 1024
[4] =>
)

)

[1] => Array
(
[file] => /usr/share/php/Mail/mimeDecode.php
[line] => 186
[function] => raiseerror
[class] => mail_mimedecode
[type] => ->
[args] => Array
(
[0] => No boundary found for multipart/mixed part
)

)

[2] => Array
(
[file] => /usr/share/php/Mail/mimeDecode.php
[line] => 172
[function] => decode
[class] => mail_mimedecode
[type] => ->
[args] => Array
(
[0] => Array
(
[include_bodies] => 1
[decode_bodies] => 1
[decode_headers] =>
[input] => Received: from localhost (localhost.dataconsult.de [127.0.0.1])
by mail2.data-consult.de (Postfix) with ESMTP id E1D16833F0
for <achim.schneider@dataconsult.de>; Mon, 31 Oct 2005 12:51:23 +0100 (CET)
X-Original-To: info@data-consult.de
Delivered-To: achim.schneider@data-consult.de
Received: from data-consult.de [62.216.169.124]
by localhost with POP3 (fetchmail-6.2.5.2)
for achim.schneider@dataconsult.de (single-drop); Mon, 31 Oct 2005 12:51:23 +0100 (CET)
Received: from localhost (dcws03 [127.0.0.1])
by mail.data-consult.de (Postfix) with ESMTP id 0C179140031
for <info@data-consult.de>; Mon, 31 Oct 2005 12:46:46 +0100 (CET)
Received: from neo2.schlundtech.de (pizza.internetx.de [62.116.129.3])
by mail.data-consult.de (Postfix) with ESMTP id 19A9F140016
for <info@data-consult.de>; Mon, 31 Oct 2005 12:46:37 +0100 (CET)
Received: from neo2.schlundtech.de (localhost [127.0.0.1])
by neo2.schlundtech.de (8.12.3/8.12.3/Debian-6.4) with ESMTP id j9VBkV44013335
for <info@data-consult.de>; Mon, 31 Oct 2005 12:46:31 +0100
Received: (from www-data@localhost)
by neo2.schlundtech.de (8.12.3/8.12.3/Debian-6.4) id j9VBkVg7013333;
Mon, 31 Oct 2005 12:46:31 +0100
Date: Mon, 31 Oct 2005 12:46:31 +0100
Message-Id: <200510311146.j9VBkVg7013333@neo2.schlundtech.de>
To: info@data-consult.de
Subject: Schlund Technologies Rechnung R90167350
From: billing@schlundtech.de
MIME-Version: 1.0
Content-Type: multipart/mixed;boundary = bc89074f6a654550bea48836f6c026ea8
X-Virus-Scanned: by amavisd-maia-1.0.0-rc4 (Debian) at data-consult.de
X-Spam-Status: No, hits=1.4 tagged_above=-999.0 required=5.0
tests=MIME_BASE64_TEXT, NO_REAL_NAME
X-Spam-Level: *

This is a MIME encoded message.

--bc89074f6a654550bea48836f6c026ea8
Content-Type: text/plain
Content-Transfer-Encoding: base64

U2VociBnZWVocnRlL3IgSGVyci9GcmF1IEphbiBN9m5uaWNoLAoKZGllc2UgRS1NYWlsIGVudGjk
bHQgZGllIGFrdHVlbGxlIFNjaGx1bmQgVGVjaG5vbG9naWVzClJlY2hudW5nIFI5MDE2NzM1MC4g
QmVpIEZyYWdlbiB6dSBkaWVzZXIgUmVjaG51bmcgd2VuZGVuIFNpZQpzaWNoIGJpdHRlIGFuOiBi
aWxsaW5nQHNjaGx1bmR0ZWNoLmRlCgpTaWUga/ZubmVuIGRpZXNlIFJlY2hudW5nIGViZW5mYWxs
cyBpbiBJaHJlbSBSZWNobnVuZ3NhcmNoaXYKb25saW5lIGVpbnNlaGVuLiBMb2dnZW4gU2llIHNp
Y2ggZGF6dSBiaXR0ZSBpbiBJaHIgS29uZmlnLU1lbvwgZWluLgoKClZpZWxlIEdy/HNzZQoKSWhy
ZSBTY2hsdW5kIFRlY2hub2xvZ2llcyBCdWNoaGFsdHVuZwoKQW5oYW5nOiBSOTAxNjczNTAucGRm
IFJlY2hudW5nIE5yLiA5MDE2NzM1MA==

--bc89074f6a654550bea48836f6c026ea8
Content-Type: application/pdf; name = "R90167350.pdf"
Content-Transfer-Encoding: base64

JVBERi0xLjMKMyAwIG9iago8PC9.....cutted here....Zm8gMTUgMCBSCj4+CnN0YXJ0eHJlZgoyNDEyNAolJUVPRgo=

--bc89074f6a654550bea48836f6c026ea8--

)

)

)

[2005-12-02 13:59 UTC] cm at data-consult dot de

this is the same error mentioned here:
http://pear.php.net/bugs/4585

problem is a space in the header for boundary
so boundary looks like this:

[boundary ] = fdshdfsdfhdfsksfdsdfhkj

i added some trims to the code to fix this:

line 235 change
$return->ctype_parameters[$p_name] = $p_value;
to
$return->ctype_parameters[trim($p_name)] = trim($p_value);

line 393:
$hdr_name = substr($value, 0, $pos = strpos($value, ':'));
to
$hdr_name = trim(substr($value, 0, $pos = strpos($value, ':')));

line 442:
$return['other'][$param_name] = $param_value;
to
$return['other'][trim($param_name)] = trim($param_value);

i hope i dont missed anything, but this works for me.