In mailparse version 2.1.1 (and perhaps earlier), when using mailparse_msg_extract_part() with a callback function, it breaks the data it passes to it into 4kB chunks and calls the callback function for each chunk. So, for example, if it's extracting a 41kB MIME part, the callback function you define will be called 11 times, each time with the next chunk of data. Here's some quick-and-dirty code that shows one way to handle this:
<?php
$message = file_get_contents ("email.txt"); function catch_part ($part)
{
$GLOBALS["part_data"] .= $part; }
mailparse_msg_extract_part ("1.1", $message, "catch_part"); echo $GLOBALS["part_data"]; ?>
There's probably a much better way of dealing with this, but hey. It's what I got.