note 24312 added to function.imap-fetchbody

From: Date: Tue, 13 Aug 2002 00:54:56 +0000
Subject: note 24312 added to function.imap-fetchbody
Groups: php.notes 
Request: Send a blank email to php-notes+get-34903@lists.php.net to get a copy of this message
Maybe you prefer a short and recursive way to parse a message and get the part numbers built: ------------------------------------------------------------- function parse_message($obj, $prefix="") { /* Here you can process the data of the main "part" of the message, e.g.: */ do_anything_with_message_struct($obj); if (sizeof($obj->parts) > 0) foreach ($obj->parts as $count=>$p) parse_part($p, $prefix.($count+1)); } function parse_part($obj, $partno) { /* Here you can process the part number and the data of the parts of the message, e.g.: */ do_anything_with_part_struct($obj,$partno); if ($obj->type == TYPEMESSAGE) parse_message($obj->parts[0], $partno."."); else if (sizeof($obj->parts) > 0) foreach ($obj->parts as $count=>$p) parse_part($p, $partno.".".($count+1)); } /* Let's say, you have an already opened mailbox stream $mbox and you like to parse through the first message: */ $msgno = 1; parse_message(imap_fetchstructure($mbox,$msgno)); -- http://www.php.net/manual/en/function.imap-fetchbody.php http://master.php.net/manage/user-notes.php?action=edit+24312 http://master.php.net/manage/user-notes.php?action=delete+24312 http://master.php.net/manage/user-notes.php?action=reject+24312

« previous php.notes (#34903) next »