Re: Using TIdMesage.LoadFromStream

Giganews Newsgroups
Subject: Re: Using TIdMesage.LoadFromStream
Posted by:  Remy Lebeau (TeamB) (
Date: Tue, 17 Feb 2004

"Christian Kaufmann" <christian.kaufma…> wrote in message

> I want to use TIdMessage.LoadFromStream to read all
> emails from a Mozilla mail file.

I do not think that LoadFromStream() supports streams with multiple messages
contained inside of it.  Each message should be in its own stream.

> I already fail to read the first email from the file. The call
> to LoadFrom Stream never returns, except when I set
> HeadersOnly to true.

Are the messages delimited with a trailing "." in between them?  Without
that, LoadFromStream() continues waiting for data endlessly.

> Then I read that LoadFromStream does not change the
> position in my file steam.

It should be, since the reading simply calls TStream.Read() when needed,
which always increments the Position.

> But how do I know the size of the email read in
> order to update the file stream position to read the next email ?

If the Position really is not being incremented, then you would probably
have to parse the file stream manually.

> I use Indy 9.0.11 and D6

You are using an older version of Indy.  Try upgrading to the latest
snapshot version of 9.0.14.



In response to

Using TIdMesage.LoadFromStream posted by Christian Kaufmann on Tue, 17 Feb 2004