/** * Returns a parsed MIME message * * @param string $text The text of the message * * @return array An array with the MIME parsed headers and body. */ function _mimeParse(&$text) { /* Taken from Horde's MIME/Structure.php */ require_once 'Mail/mimeDecode.php'; /* Set up the options for the mimeDecode class. */ $decode_args = array(); $decode_args['include_bodies'] = true; $decode_args['decode_bodies'] = false; $decode_args['decode_headers'] = false; $mimeDecode = new Mail_mimeDecode($text, MIME_PART_EOL); if (!($structure = $mimeDecode->decode($decode_args))) { return false; } /* Put the object into imap_parsestructure() form. */ MIME_Structure::_convertMimeDecodeData($structure); return array($structure->headers, $ret =& MIME_Structure::parse($structure)); }