this may be the way, how to obtain all those part_numbers.... even when a message contains another message attached, and it contains another message attached...
<?
$parttypes = array ("text", "multipart", "message", "application", "audio", "image", "video", "other");
function buildparts ($struct, $pno = "") {
global $parttypes;
switch ($struct->type):
case 1:
$r = array (); $i = 1;
foreach ($struct->parts as $part)
$r[] = buildparts ($part, $pno.".".$i++);
return implode (", ", $r);
case 2:
return "{".buildparts ($struct->parts[0], $pno)."}";
default:
return '<a href="?p='.substr ($pno, 1).'">'.$parttypes[$struct->type]."/".strtolower ($struct->subtype)."</a>";
endswitch;
}
$struct = imap_fetchstructure ($pop3mbox, $msguid, FT_UID);
echo buildparts ($struct);
?>
it will print something like:
<a href="?p=1">text/plain</a>, {<a href="?p=2.1">text/plain</a>, <a href="?p=2.2">text/html</a>}