mimeDecode, octet-stream attachment
| From: | Mark Heintz PHP Mailing Lists | Date: | Tue, 12 Mar 2002 19:19:40 +0000 |
| Subject: | mimeDecode, octet-stream attachment | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-960@lists.php.net to get a copy of this message | ||
A question... is mimeDecode (1.21) capable of handling binary
attachments? I'm passing decode() a two-part message, and while the
'parts' array in the returned structure has two elements, the second part
is empty.
Thanks,
mth.
Details for those interested...
Input (trimmed):
From
(trimmed)
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
BOUNDARY="-623835013-580713697-1015867418=:12244"
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---623835013-580713697-1015867418=:12244
Content-Type: TEXT/PLAIN; charset=US-ASCII
test body
---623835013-580713697-1015867418=:12244
Content-Type: APPLICATION/octet-stream; name="test.tar.gz"
Content-Transfer-Encoding: BASE64
Content-ID:
Content-Description:UFRSRVNGSUxFABMBBAAAAEJhc2VsaW5lAAAAAAAAAAAAAAAAAAAAAAAAAAAA
(trimmed)
AAAAAAAAAAAAAAAAAAAAAAA=
---623835013-580713697-1015867418=:12244--
Content-Disposition: attachment; filename="test.tar.gz"
Code:
<?php
$params['include_bodies'] = TRUE;
$params['decode_bodies'] = TRUE;
$params['decode_headers'] = TRUE;
$decoder = new Mail_mimeDecode($input);
$structure = $decoder->decode($params);
print_r($structure);
?>
Output (trimmed):
stdClass Object
(
[headers] => Array
(
(trimmed)
[mime-version] => 1.0
[content-type] => MULTIPART/MIXED;
BOUNDARY="-623835013-580713697-1015867418=:12244"
)
[ctype_primary] => MULTIPART
[ctype_secondary] => MIXED
[ctype_parameters] => Array
(
[BOUNDARY] => -623835013-580713697-1015867418=:12244
[boundary] => -623835013-580713697-1015867418=:12244
)
[parts] => Array
(
[0] => stdClass Object
(
[headers] => Array
(
[content-type] => TEXT/PLAIN; charset=US-ASCII
)
[ctype_primary] => TEXT
[ctype_secondary] => PLAIN
[ctype_parameters] => Array
(
[charset] => US-ASCII
)
[body] =>
test body
)
[1] => stdClass Object
(
[headers] => Array
(
[] =>
)
[ctype_primary] => text
[ctype_secondary] => plain
[body] =>
)
)
)