PHP Classes

Parse HTML mail

Recommend this page to a friend!

      Parse Mail  >  All threads  >  Parse HTML mail  >  (Un) Subscribe thread alerts  
Subject:Parse HTML mail
Summary:using parse mail to parse HTML or multipart messages !
Messages:1
Author:Mathieu Maes
Date:2005-08-08 22:18:28
 

  1. Parse HTML mail   Reply   Report abuse  
Picture of Mathieu Maes Mathieu Maes - 2005-08-08 22:18:28
Hello !

I'm implementing Parse mail in a PHP script which receives mails with STDIN. All worked fine for now, until I tested with HTML or multipart mail messages. The mail message body is screwed up ! :

print_r ($email[part]) gives me :
[0] => Array
(
[Content-Type] => multipart/alternative;
boundary="----=_Part_2132_14882511.1123538473424"
[content] => ------=_Part_2132_14882511.1123538473424
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

test message

------=_Part_2132_14882511.1123538473424
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

test message

------=_Part_2132_14882511.1123538473424--


)


1. is there a way how to detect a multipart mail ?
2. how can I parse it so I get the plain text message only ??