Hi guys,
I am using Zend_Mail_Storage_Mbox to read mails from mbox but it seems to me
that I cannot get all parts. I sent an example mail with text (text/plain), html
(text/html) and an attached (image/png) inline part. I've attached the mbox to
this email (mbox.txt).
require_once 'Zend/Mail/Storage/Mbox.php';
$mbox = new Zend_Mail_Storage_Mbox(array(
'filename' => '/home/jan/Desktop/mbox.txt'
));
require_once 'Zend/Debug.php';
Zend_Debug::dump($mbox->getMessage(1));
object(Zend_Mail_Message_File)#2 (12) {
["_flags:protected"] => array(0) {
}
["_contentPos:protected"] => array(2) {
[0] => int(330)
[1] => int(1353)
}
["_partPos:protected"] => array(2) {
[0] => array(2) {
[0] => int(468)
[1] => int(953)
}
[1] => array(2) {
[0] => int(990)
[1] => int(1314)
}
}
["_fh:protected"] => resource(13) of type (stream)
["_headers:protected"] => array(7) {
["return-path"] => string(27) "<[email protected]>"
["to"] => string(25) "[email protected]"
["subject"] => string(8) "Testmail"
["from"] => string(25) "[email protected]"
["date"] => string(31) "Sat, 06 Jan 2009 13:55:40 +0100"
["content-type"] => string(79) "multipart/mixed; charset="utf-8";
boundary="=_1f37c4c6837f0c1cbc45a73c7af851ba""
["mime-version"] => string(3) "1.0"
}
["_content:protected"] => NULL
["_topLines:protected"] => string(0) ""
["_parts:protected"] => array(0) {
}
["_countParts:protected"] => int(2)
["_iterationPos:protected"] => int(1)
["_mail:protected"] => NULL
["_messageNum:protected"] => int(0)
}
As you can see ($_partPos) there are only two parts.
$mbox->getMessage(1)->getPart(0); // part not found
$mbox->getMessage(1)->getPart(1); // text/html part
$mbox->getMessage(1)->getPart(2); // image/png part (base64)
$mbox->getMessage(1)->getPart(3); // part not found
Am I doing something wrong? Why is one part missing?
-- Jan
From [email protected] Sat Jan 6 13:55:41 2009
Return-Path: <[email protected]>
To: [email protected]
Subject: Testmail
From: [email protected]
Date: Sat, 06 Jan 2009 13:55:40 +0100
Content-Type: multipart/mixed; charset="utf-8";
boundary="=_1f37c4c6837f0c1cbc45a73c7af851ba"
MIME-Version: 1.0
This is a message in Mime Format. If you see this, your mail reader does not
support this format.
--=_1f37c4c6837f0c1cbc45a73c7af851ba
Content-Type: multipart/alternative;
boundary="=_d501a90e2649c7e24f8d3078a591f610"
Content-Transfer-Encoding: 8bit
--=_d501a90e2649c7e24f8d3078a591f610
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Hello world
--=_d501a90e2649c7e24f8d3078a591f610
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html><head><title></title></head><body>Hello world</body></html>
--=_d501a90e2649c7e24f8d3078a591f610--
--=_1f37c4c6837f0c1cbc45a73c7af851ba
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-ID: <50de13e501e6236f15c1a4fe1d07ef96>
Content-Disposition: inline; filename="example.png"
iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAQMAAAAk8RryAAAABlBMVEWurq4zMzOJRNl/AAAA
IklEQVQYlWNgGPzgAYRiloDQLCyoNAcTdhpdHUw/zLxBCQCxnQI1BtXliAAAAABJRU5ErkJg
gg==
--=_1f37c4c6837f0c1cbc45a73c7af851ba--