Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2004, 10:12 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to extract contents of an e-mail in html/rtf

hello all,

please help me out in this regard. I gotta extract the content [body, title text] of an e-mail that's in html/rtf format. What's the best way to do this? any sample codes or components that may help me? please help me out in this regard.

Regards,
Mogli
 
Old April 24th, 2004, 05:05 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Can you be more specific? Do you need to connect to a mailbox and read the contents of the mailbox?

Regards,
Rich



::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old April 25th, 2004, 10:56 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello richard,

thanks for your quick response.

The following is what exactly i am looking for:

We have a support system that creates support tickets in database based on the e-mails sent by customers. This is all fine when the e-mail is in text format. But if the same is in rtf/html it's becoming tough to parse thru the content [mail body]. Are there any ways of handling this efficiently. Please help me out in this regard.

Regards,
Mogli
 
Old April 25th, 2004, 01:11 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Have you considered using strip_tags on the HTML message to convert it to plain text, and then running your algorithms?

http://www.php.net/strip_tags

Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old September 15th, 2004, 12:35 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dickies
Default

hii,
pls help i'm new in php,
how to get subject n sender address from an e-mail?
coz i want to have send back a request from user whom send a request e-mail (request is type in subject).
thanx.....

 
Old September 15th, 2004, 04:25 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Well that all depends on how you are connecting to the mailbox. The easiest and most efficient way to do it is via the c-client extension..
http://www.php.net/imap

If you're using the c-client extension you can use the imap_headerinfo function to read the specifc headers of a message.
http://www.php.net/imap_headerinfo

Otherwise you're likely to be using PHP itself (as opposed to the c-client extension which is written in C) to parse the structure of a message. In which case, parsing a MIME message is a complicated undertaking not easily describable in a few forum posts. I beleive the PEAR Mail_MIME package has functionality for parsing MIME messages and headers.

Of course you are also welcome to have a look at my Mail_IMAP PEAR package, which is a solution that uses the c-client extension to access mailboxes and does all the header and message parsing for you.
http://www.smilingsouls.net/index.ph...ail_IMAP/index

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to extract text from html??? naureen Java Basics 2 October 2nd, 2007 11:19 AM
convert a RTF text into HTML tag gmbalaa General .NET 0 August 16th, 2007 04:06 AM
XML to rtf and html .Can not see images bvprasad XSLT 6 November 28th, 2006 01:27 AM
Extract data from Word Document(RTF format) PaulJH Access 2 September 19th, 2006 07:52 AM
send contents of cart via e-mail paulk BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 1st, 2006 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.