Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: "Simple" MIME file extract
| Subject: | Re: "Simple" MIME file extract |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 12 May 2006 13:21:27 |
"Bob Goldstine" <ttgchicago@aol.com> wrote in message
news:4464c8fa$1@newsgroups.borland.com...
> Too much for a newb to get their arms around. Indy has about 200
> components, 15-20 of which seem to be MIME related.
The only component you have to concern yourself with is TIdMessage. It does
all of the work for you. All of the MIME components are helper classes that
TIdMessage uses internally.
> how easy/difficult a process is this?
Very easy.
> I thought this would be something as simple as loading the mime file
> and spitting out the message body text.
You have to take into account that MIME is very flexible, and such
MIME-encoded messages can be quite complex to parse. Where the body text is
stored in the TIdMessage depends on the original format of the message
content. If the message is not MIME-encoded, or does not contain any
attachments or multiple versions of the text (plain, html, rtf, etc), then
the text is stored in the TIdMessage.Body property. On the other hand, if
there are attachments, or there are multiple versions of the text, then it
is stored in TIdText objects within the TIdMessage.MessageParts property
instead.
There is also one other scenerio you have to watch your for - MSOutlook rich
text messages. These are stored as TNEF-encoded attachments instead. In
which case, you have to locate the appropriate TIdAttachment in the
TIdMessage.MessageParts property, and then use the TIdCoderTNEF componet to
parse the attachment into a TIdMessage.
> Do I have to parse the mime
That is done automatically by TIdMessage.
> read the contents-types / drill down levels etc.
Potentially, yes. TIdMessage will abstract the levels into TIdText and
TIdAttachment objects in the TIdMessage.MessageParts property, but you still
have to loop throug them yourself to find what you need.
> or are these tasks overkill for what Im trying to achieve?
That depends on what you are trying to accomplish in the first place.
Gambit