
Ketil Engmark - 2013-04-22 10:43:27 -
In reply to message 2 from Manuel Lemos
Hi
I think I may be using the wrong code.
Here is what I am using. It was working for text emails.
$mime=new mime_parser_class;
$mime->ignore_syntax_errors = 1;
$parameters=array('Data'=>$email,);//this is saved as source
$mime->Decode($parameters, $decoded);
//---------------------- FIND THE BODY -----------------------//
//get the message body
if(substr($decoded[0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Body'])){
$body = $decoded[0]['Body'];
} elseif(substr($decoded[0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Parts'][0]['Body'])) {
$body = $decoded[0]['Parts'][0]['Body'];
} elseif(substr($decoded[0]['Parts'][0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' && isset($decoded[0]['Parts'][0]['Parts'][0]['Body'])) {
$body = $decoded[0]['Parts'][0]['Parts'][0]['Body'];
}
Is this ok to use?
Thanks