Re: Reading incoming messages

Giganews Newsgroups
Subject: Re: Reading incoming messages
Posted by:  Remy Lebeau (TeamB) (
Date: Tue, 8 Jun 2004

"Rhys Sage" <abuse@> wrote in message

> I'm trying to read an incoming, mime-encoded email.
> I'm using the following:

For future reference, always specify which version of Indy you are actually
using.  In this case, your code is trying to use a PartType property.  That
only exists in Indy 10.

>  if (IdMessage1.MessageParts.Items[PartCounter].PartType is TIdText) then

That is not the property way to test the PartType.  It should be this

    if (IdMessage1.MessageParts.Items[PartCounter].PartType = mptText) then

If you want to compare against TIdText then you have to query the Item
instance itself, not its PartType property:

    if (IdMessage1.MessageParts.Items[PartCounter] is TIdText) then

> Memo1.Lines.AddStrings(IdMessage1.MessageParts.Items[PartCounter]);

You have to cast the Item to a TIdText in order to get at its textual


> Also are there any other, aside from TIdAttachment?

Not at the moment.  However, there may be a new TIdTNEF type introduced at a
future date, to handle MS Office TNEF-encapsulated messages.  But that
coding is still in the works.



In response to

Reading incoming messages posted by Rhys Sage on Tue, 8 Jun 2004