Okay, so let's say I have a message fetched from a pop3 server.
What I ultimately want to do is to put it in its corresponding user's mailbox, which is an XML file. For the headers, I managed something good already, so I don't need to think about it, I have to do the message body's part.
How should I process the file?
For now, my logic would be
For retrieval:
Go get the mime types (multipart or not) and build a hierarchy
of items and subitems, or something.
For display:
1. Check the mime type
1a - Is Multipart:
Go to the boundary and check the mime type.
If is multipart, fire 1a again, with this boundary instead.
1b Is text/plain
Format using endlines
1c Is text/html
Don't bother with formatting, strip dangerous stuff.