Jan Pieper wrote:
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--
You have this tree:
Mail : multipart/mixed
Part 1: multipart/alternative
Part 1.1: text/plain
Part 1.2: text/html
Part 2: application/octet-stream
So you either use $message->getPart(1)->getPart(1) to get the plain
text part (1 and 2 for html, just 2 for attachment) or you flatten the
tree with a RecursiveIteratorIterator (Zend_Mail_Part and
Zend_Mail_Message implement RecursiveIterator).
nico