Board index » delphi » TIdPop3 sometimes doesn't read message

TIdPop3 sometimes doesn't read message

Hi,

I have a very simple application that runs every day to clear a POP3 mail folder. The folder usually has thousands of messages in it. I run through the folder reading the messages using TIdPop3.Retrieve (saving particular ones) and then deleting them with TIdPop3.Delete. That's it.

Problem: The retrieve code is in a try finally block. Every so often the Retreive fails on a particular message. Although the loop carries on to the end with no further problems. NO messages get deleted at all on the Disconnect.

Deleting the rogue message usually solves the problem, but it can me incredibly hard to locate, so its not really an answer.

Anybody have any thoughts, or failing that suggestions as to how I may debug this?

 

Re:TIdPop3 sometimes doesn't read message


Quote
Howard Miller wrote:
> Anybody have any thoughts, or failing that suggestions as to how I
> may debug this?

I used to have similar problems, however, since I stopped using the
TIdMessage-component due to bug #570766, I faced this with the
readln-functions maximum line length. When a line to be received was
longer than the default value, function threw an exception that caused
my application to miss the particular message.

I don't know whether this is the problem in your case, but it's
certainly a good place to start debugging things. Of course, you could
also include a debug message in the finally-clause like...

try
  Ok := FALSE;
  // Do your stuff here
  Ok := TRUE;
finally
  if not Ok then ShowMessage('Retrieving failed on msg ?');
end;

...or something similar...

--
Markku Uttula

URL: http://www.disconova.com/utu/  "Are you hot? Or at least cute?"
MAIL: markku.utt...@disconova.com   "If not, are you at least easy?"

Re:TIdPop3 sometimes doesn't read message


In article <3d5b7617$1@dnews>, m...@howardmiller.co.uk says...

Quote

> Hi,

> I have a very simple application that runs every day to clear a POP3 mail folder.
> The folder usually has thousands of messages in it. I run through the folder reading
> the messages using TIdPop3.Retrieve (saving particular ones) and then deleting them
> with TIdPop3.Delete. That's it.

> Problem: The retrieve code is in a try finally block.
> Every so often the Retreive fails on a particular message. Although the loop carries
> on to the end with no further problems. NO messages get deleted at all on the Disconnect.

> Deleting the rogue message usually solves the problem,
> but it can me incredibly hard to locate, so its not really an answer.

> Anybody have any thoughts, or failing that suggestions as to how I may debug this?

POP3 mail servers are (really) deleting downloaded mails after
disconnection of the client.
You should try to include an exception handler in the loop and do a
disconnect from the server after each exception.
Other proposal: try to download the mail in packages i.e. 100 per
connect and repeat this until all mails are downloaded.

--
Willi
... von den Baumwollfeldern der Rhoen

Other Threads