Decode mail's body using PEAR

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kloss26
Forum Newbie
Posts: 1
Joined: Thu Oct 09, 2003 10:40 am

Decode mail's body using PEAR

Post by kloss26 »

Hi, I have problems showing the message's body. If it was went by Outlook, for example, this is the result:

------=_NextPart_000_0001_01C38E89.E2240120
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Esto es un mensaje de prueba

------=_NextPart_000_0001_01C38E89.E2240120
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I try to decode it using mimeDecode class of PEAR, but nothing changes:

require_once 'Mail/mimeDecode.php';

$conmail = imap_open("{myserver/pop3:110}INBOX","user","password");

$body = imap_body($conmail, $id);

$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;

$params['input'] = $body;

$structure = Mail_mimeDecode::decode($params);

echo $structure->body;

Thank you very much
Post Reply