TIdPOP3Server download with Ourlook 2002/XP

Giganews Newsgroups
Subject: TIdPOP3Server download with Ourlook 2002/XP
Posted by:  Pierre Roux (pier…@infofx.co.za)
Date: Mon, 10 May 2004

I'm using TIdPOP3Server in a service and is downloading e-mail with Outlook
2002/XP from it.  It seems like Outlook 'misses' some responses from the
TIdPOP3Server.  There is no real consistancy other than the problem always
happening within the first 10 downloads from the server, even if the mailbox
didn't change at all.

I'm using events linked to Command Handlers set up in the TIdPOP3Server

The procedure that processes the UIDL command logs at the very beginning of
the procedure, and stepping through the code shows no exceptions.  Straight
after the error, sending and receiving continues without hassles.  Not
stopping the server program in between, do nothing with Outlook.

I am unsure about the way I send my replies back.  It seems to work fine
throughout the rest of the code.  Is this way of doing it correct?
Is there a better way of doing it?

Code, log file and error responses below:

procedure TsrvMailServer.POP3ServerchSTATCommand(ASender: TIdCommand);
  ServerAdmin    :  TServerAdmin;
  sResponse      :  String;
  ServerAdmin    :=  TServerAdmin.Create (sBaseDir);

  if ServerAdmin.GetSTAT (TIdPOP3ServerThread(ASender.Thread).Username
,ASender.Thread.ThreadID ,sResponse) then
    ASender.Reply.TextCode := '+OK';
    ASender.Reply.Text.Add (sResponse);
    ASender.Reply.TextCode := '-ERR';
    ASender.Reply.Text.Add ('Stat Failed');
    ServerAdmin.Log(ltPOP3, ' STAT Failed: Mail Dir' );  <- Just does some
  ServerAdmin.Log(ltError, 'POP3 : STAT Command Failed.');
  ServerAdmin.Log(ltPOP3, 'POP3 STAT '+ ASender.Params.Text);

POP3 Log:
[2004/05/10 01:35:41 AM] Connected
[2004/05/10 01:35:41 AM] POP3 Authenticate
[2004/05/10 01:35:41 AM] POP3 STAT
[2004/05/10 01:35:41 AM] POP3 UIDL
[2004/05/10 01:35:41 AM] POP3 QUIT
[2004/05/10 01:35:41 AM] Disconnected
[2004/05/10 01:36:11 AM] Connected
[2004/05/10 01:36:11 AM] POP3 Authenticate
[2004/05/10 01:36:11 AM] POP3 STAT
[2004/05/10 01:36:11 AM] POP3 UIDL
[2004/05/10 01:36:11 AM] POP3 QUIT
[2004/05/10 01:36:11 AM] Disconnected
[2004/05/10 01:36:18 AM] Connected
[2004/05/10 01:36:18 AM] POP3 Authenticate
[2004/05/10 01:36:18 AM] POP3 STAT    <-- at this Point Outlook just sits
and does nothing.  No new mail or changes in the mailbox.
[2004/05/10 01:46:18 AM] Connected  <-- Right after error is logged in Error
[2004/05/10 01:46:18 AM] POP3 Authenticate
[2004/05/10 01:46:18 AM] POP3 STAT
[2004/05/10 01:46:18 AM] POP3 UIDL
[2004/05/10 01:46:18 AM] POP3 LIST
[2004/05/10 01:46:18 AM] POP3 RETR
[2004/05/10 01:46:18 AM] POP3 QUIT
[2004/05/10 01:46:18 AM] Disconnected
[2004/05/10 01:47:25 AM] Connected
[2004/05/10 01:47:25 AM] POP3 Authenticate
[2004/05/10 01:47:25 AM] POP3 STAT
[2004/05/10 01:47:25 AM] POP3 UIDL
[2004/05/10 01:47:25 AM] POP3 QUIT
[2004/05/10 01:47:25 AM] Disconnected

Error Log:
[2004/05/10 01:46:18 AM] Critical POP3 Server Failure: Connection Closed

I interpreted this as TIdPOP3Server timed out waiting for a new command from

Outlook Error:
Task 'Test Account - Sending and Receiving' reported error (0x8004210A) :
'The operation timed out waiting for a response from the receiving (POP)
server. If you continue to receive this message, contact your server
administrator or Internet service provider (ISP).'

Using Delphi 7 and Indy 9.0.14