
Edward Hibbert - 2012-07-23 19:48:52 -
In reply to message 4 from Manuel Lemos
I found it easier to use the Decode. Code here if anyone needs it.
function getTextBP($logh, $parts)
{
$textbody = '';
foreach ($parts as $part)
{
fwrite($logh , "Process bodypart\n");
fwrite($logh , "ctype " . $part['Headers']['content-type:'] . "\n");
if (strpos($part['Headers']['content-type:'], "multipart/alternative") !== false)
{
return(getTextBP($logh, $part['Parts']));
}
else if (strpos($part['Headers']['content-type:'], "text/plain") !== false)
{
fwrite($logh, "Got text/plain\n");
$textbody = $part['Body'];
break;
}
}
return($textbody);
}
$textbody = getTextBP($logh, $decoded['0']['Parts']);