and this http://www.php.net/manual/en/function.imap-fetchstructure.php
----- Original Message ----- From: "David Bouw" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, December 27, 2001 11:44 AM Subject: [PHP] Translating email to (real) plain text... > Hi there, > > I would like to ask some suggestions on my following problem: > > I am making a small tool which allows you to store incomming mail in a database table. > This mail is then scanned on keywords etc etc and with the help of some status bits the > priority > is given. Via a webpage interface, people can then answer these emails... > > I started out by creating a extra Mailbox to which I route all the incoming mail. With the > help of > a Cron-Job which runs a PHP class made by Manual Lemos to retrieve POP mail I retrieve the > mail and > insert it into a database table (MySQL) > > So far so good! Only problem which I have is that some (=most) people create email with > clients that > output email with HTML codes (Internet Explorer for example).. > > I am not really interested in any attachment, pictures etc which are sent with the email, > only the plain > email body is important. > For emails that contain HTML tags, I think that stripping the HTML tags will do enough for > me.. > > I do though have a problem when dealing with emails in which text is Mime-encoded. > The Mime_Class from Manual encodes everything for example.. > > Before I spend a great deal of time making some code which can decode and strip all the > diferent email-client formats, isn't there a class out there which can get me the plain > text email body out of a raw retrieved email..?? > The Mailling-list archives of this PHP maillinglist at > http://marc.theaimsgroup.com/?l=php-general for example contains very nicely stripped > emails of all the members.. > > Does anyone khow this is done..? > > Thanks in advance for any help.. > > With kind regards.. > > David Bouw > > PS: To give some examples of problems I see in the retrieved mail I have quoted some > pieces: > > -------------------------------------------------------------------------- ---------------- > ------ > //A stripslashes will do a lot for me.. > > ------=_NextPart_001_0071_01C18105.33ABC800 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > This is a mail send to myself > > ------=_NextPart_001_0071_01C18105.33ABC800 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > <HTML><HEAD> > <META content=3D"text/html; charset=3Diso-8859-1" = > http-equiv=3DContent-Type> > <META content=3D"MSHTML 5.00.3314.2100" name=3DGENERATOR> > <STYLE></STYLE> > > -------------------------------------------------------------------------- ---------------- > ------ > //I can probably us mime_decode, but I think that this will take quite some hours to > code.. > > This is a MIME encoded message. > Created by html_mime_mail.class. > See http://www.heyes-computing.net/scripts/ for a copy. > > --=_7c76c35e24d83834b9c31a94ad6407ca > Content-Type: multipart/alternative;boundary="=_c15b829df5ff4f43680605bb761b564f > " > > > --=_c15b829df5ff4f43680605bb761b564f > Content-Type: text/plain > Content-Transfer-Encoding: base64 > > PFBSRT5CZXN0ZSBQYXRyaWMgVmVyaG9ldmVuLAoKV2lqIHdpbGxlbiB1IGdyYWFnIGRlIHN0YXR1 ^M > cyB2YW4gdXcgYmVzdGVsbGluZyBkb29yZ2V2ZW4uClV > -------------------------------------------------------------------------- ---------------- > ------ > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]