Re: Reading incoming messages

Giganews Newsgroups
Subject: Re: Reading incoming messages
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Tue, 8 Jun 2004

"Rhys Sage" <abuse@127.0.0.1> wrote in message
news:32131F3253A0E240abuse@127.0.0.1...

> 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
instead:

    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
content:

Memo1.Lines.AddStrings(TIdText(IdMessage1.MessageParts.Items[PartCounter]).B
ody);

> 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.

Gambit

Replies

In response to

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