// position after first boundary line
$start =
$p + 3 +
strlen($boundary);
while (($p =
strpos($body, '--' .
$boundary . "\n",
$start)) !== false
) { $res[] =
substr($body,
$start,
$p-
$start);
$start =
$p + 3 +
strlen($boundary);
} // no more parts, find end boundary
$p =
strpos($body, '--' .
$boundary . '--',
$start);
if ($p===false
) { throw new Zend_Exception('Not a valid Mime Message: End Missing'
);
} // the remaining part also needs to be parsed:
$res[] =
substr($body,
$start,
$p-
$start);
return $res;
} /**
* decodes a mime encoded String and returns a
* struct of parts with header and body
*
* @param string $message raw message content
* @param string $boundary boundary as found in content-type
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
* @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found
* @throws Zend_Exception
*/