IMAP - body

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
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

IMAP - body

Post by fractalvibes »

I am attempting to use IMAP to provide some users online viewing of email. When I display the body of the email, there is all kinds of extraneous info that the user won't care to see...content type, content disposition, lots of -----------------some gibberish here----+, thetext of body twice, once in plain text, once in formatted text.

Is there a reilable way to just pull :
Sender
CC
Date
Subject
The body of the email the sender typed, minus all the gibberish.

thanks,

Phil Jackson
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

format is headers blank-line body
parsing headers is pretty simple, as they are always Fieldname: data
parsing the body can be a very complex tax, you probably want to find an email parsing script (I don't know how much the PHP-IMAP module can do).. the biggest problem is that many email clients aren't always following the standards, so the parsing and decoding code can take a long time to create..

Bill Gates invented the HTML-Way-To-Many-Kilobytes-for-some-text e-mail format, and when some complained he put even more waste into it by duplicating the message in multiple formats..

I once had a filter on my webserver that rejected HTML email, but unfortunately way to many people where using Bill Gates, so all other email clients satrted using it by default as well..
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

Post by fractalvibes »

Yes, thanks, the email headers look not too bad. The actual email body seems quite unpredictable, as one does not know the number of parts nor their nature till it is examined, even then it is like recieving free-form text and trying to parse out a date no matter the format.

Yet I would think this a common task that need not be reinvented. Such a powerful thing is IMAP - surely there exists something reliable for doing such a needed thing?!

Phil J.
Post Reply