xxx Guest
|
Posted: Thu Nov 27, 2003 9:01 am Post subject: Weird TIDPop3 behaviour |
|
|
Hi,
the code below generates an 'unknown header' exception:
---------------------------------------------------------------------------
var
sock :TIDPop3;
intMsgCount,x : Integer;
theMsg : TIdMessage;
begin
(...)
intMsgcount := sock.CheckMessages();
for x := 0 to intMsgCount do
begin
(...) //init of theMsg etc
sock.RetrieveMsg(x,theMsg); //Here i get a 'Unknown POP3 header'
exception
end;
(...)
---------------------------------------------------------------------------
the following code works perfectly:
---------------------------------------------------------------------------
var
sock :TIDPop3;
intMsgCount,intMsgSize,x : Integer;
theMsg : TIdMessage;
begin
(...)
intMsgcount := sock.CheckMessages();
for x := 0 to intMsgCount do
begin
(...) //init of theMsg etc
intMsgSize := sock.RetrieveMsgSize(x);
sock.RetrieveMsg(x,theMsg); //no error at all
end;
(...)
---------------------------------------------------------------------------
Why does RetrieveMsg fails if you don't call RetrieveMsgSize first? Is
this by design? I think it wouldn't be a problem at all, looking at
the POP3 protocol itself.
Note that this example is written straight from the head, in my real
code I check if the message is smaller than 6 kb, if not, it won't be
downloaden. (if intMsgSize < (1024*6) then ....)
Greetings,
ED
|
|