+
+ /** OK, we have the header information, now lets decide what to do with it **/
+ if ($ent_type0 == "multipart") {
+ $y = 0;
+ while (substr($body[$j], 0, strlen("--$bound--")) != "--$bound--") {
+ $ent_body[$y] = $body[$j];
+ $y++;
+ $j++;
+ }
+ $ent = decodeMime($ent_body, $ent_bound, $ent_type0, $ent_type1, $entities);
+ $entities = $ent;
+ } else if ($ent_type0 == "text") {
+ while (substr(trim($body[$j]), 0, strlen("--$bound")) != "--$bound") {
+ $entity_body[$p] = $body[$j];
+ $j++;
+ $p++;
+ }
+ $count = count($entities);
+ $entities[$count] = getEntity($entity_body, $ent_bound, $ent_type0, $ent_type1, $encoding, $charset, $filename);
+
+ } else {
+ $j++;
+ $entity_body = "";
+ while (substr(trim($body[$j]), 0, strlen("--$bound")) != "--$bound") {
+ $entity_body .= $body[$j];
+ $j++;
+ }
+ $count = count($entities);
+ $entities[$count] = getEntity($entity_body, $ent_bound, $ent_type0, $ent_type1, $encoding, $charset, $filename);
+ }