note 77180 added to function.imap-fetchbody
| From: | ted at qtis dot co dot nz | Date: | Sat, 18 Aug 2007 20:02:38 +0000 |
| Subject: | note 77180 added to function.imap-fetchbody | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129578@lists.php.net to get a copy of this message | ||
Here's simple way of extending Makusnospam's little routine to flatten the entire message
into an array which can be useful to quickly find the body and attachments just by walking through
the array elements.
function create_part_array($structure, $prefix="") {
$part_array = array();
if (sizeof($structure->parts) > 0) {
foreach ($structure->parts as $count => $part) {
add_part_to_array($part, $prefix.($count+1), $part_array);
}
}
return $part_array;
}
function add_part_to_array($obj, $partno, & $part_array) {
if ($obj->type == TYPEMESSAGE) {
parse_message($obj->parts[0], $partno.".");
}
else {
if (sizeof($obj->parts) > 0) {
foreach ($obj->parts as $count => $p) {
add_part_to_array($p, $partno.".".($count+1), $part_array);
}
}
}
$part_array[] = array('part_number' => $partno, 'part_object' =>
$obj);
}
----
Server IP: 202.89.58.1
Probable Submitter: 131.203.76.110
----
Manual Page -- http://www.php.net/manual/en/function.imap-fetchbody.php
Edit -- https://master.php.net/note/edit/77180
Del: integrated -- https://master.php.net/note/delete/77180/integrated
Del: useless -- https://master.php.net/note/delete/77180/useless
Del: bad code -- https://master.php.net/note/delete/77180/bad+code
Del: spam -- https://master.php.net/note/delete/77180/spam
Del: non-english -- https://master.php.net/note/delete/77180/non-english
Del: in docs -- https://master.php.net/note/delete/77180/in+docs
Del: other reasons-- https://master.php.net/note/delete/77180
Reject -- https://master.php.net/note/reject/77180
Search -- https://master.php.net/manage/user-notes.php