Fw: [PHP] Translating email to (real) plain text...
Hi Richard, 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).. Internet Explorer is a browser, it doesn't create email. It was a bit late, I meant Outlook Express which comes/came with Internet Explorer.. Does anyone khow how this is done..? Use either the imap extension, or the mimeDecode class available in PEAR, or here: http://www.phpguru.org Thanks for the tip! I grabbed (your) code and tried to decode some messages.. This (almost) worked perfectly..!!!. I only have the following problem: I (also) use your html.mime.mail class, for generating outgoing messages in php... :-) All messages generated by this class I can't decode the body.. :-( Because I am using your mime_mail.class quite some time I took a look at the version I was using.. I saw that I was still running 1.26.. I can remember that when I installed it, I had a lot of trouble getting the HTML emails to display correctly.. Back then I fixed it by removing all the '\r' characters in the source.. (I think this is the reason the decode class won't decode the body..) I grabbed version (2.0.3) with the hope that it would work out of the box.. But I still (now) have the same problem which I had with 1.26 I saw that you could define the CRLF yourself, I fiddled with '\n', '\r\n' and a few others.. But this doesn't seem to do anything for me... :-( I have attached the -not-working- generated email.. This was done using PHP 4.0.6 and the internal mail function.. (Qmail delivered the email.) I will give the smtp class a try tomorrow to see if that will work, but I still don't really understands what it does.. (Does it inject the email in mailer for the given IP number..?? Or does it try to deliver email himself to different hosts..?) I will try to solve the html.mime.class problems, and I think that will then also solve the decoding problem I have now.. Bye Bye David -- 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] 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 HTMLHEAD META content=3Dtext/html; charset=3Diso-8859-1 = http-equiv=3DContent-Type META content=3DMSHTML 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]
Re: [PHP] Translating email to (real) plain text...
I was just reading the other day the php has imap function that give you the ability to get only the body of the message. have your cron job get that and then strip HTML tags on that. Don't see why that wouldn't work. http://www.php.net/manual/en/function.imap-body.php Jim - 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 HTMLHEAD META content=3Dtext/html; charset=3Diso-8859-1 = http-equiv=3DContent-Type META content=3DMSHTML 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]
Re: [PHP] Translating email to (real) plain text...
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 HTMLHEAD META content=3Dtext/html; charset=3Diso-8859-1 = http-equiv=3DContent-Type META content=3DMSHTML 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]
RE: [PHP] Translating email to (real) plain text...
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).. Internet Explorer is a browser, it doesn't create email. Does anyone khow this is done..? Use either the imap extension, or the mimeDecode class available in PEAR, or here: http://www.phpguru.org -- Richard Heyes If you have any trouble sounding condescending, find a Unix user to show you how it's done. - Scott Adams -- 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]