I am tasked with downloading all message headers from many mail boxes, so this is my 1st try with VCL:
My problem is the value of dt: it is greater than 250ms
Meaning that I can only get 4 headers per second - this is unacceptably slow.
Tested on different mail boxes of different accounts; PC is connected to inet with 200x20 plan.
Is there a way to call RetrieveHeader for more than just 1 message at a time?
Thanks in advance, and have a nice weekend. Boba TC.
Code:
//TId components managed by the IDE
TIdIMAP4 *IdIMAP4;
Code:
TIdMailBox *IdMlBx;
Code:
TIdMessage *IdMsg;
Code:
//....IdIMAP4 is connected and authenticated
int nMsgs;
UnicodeString s = "-1";
DWORD t;
try{
if( !IdIMAP4->ExamineMailBox(asName,IdMlBx) )
throw Exception( "!ExamineMailBox" );
nMsgs = IdMlBx->TotalMsgs;
t = ::GetTickCount();
for( int iMsg=1; iMsg<=nMsgs; iMsg++ ){
if( !IdIMAP4->RetrieveHeader(iMsg,IdMsg) )
throw Exception( "!RetrieveHeader " + IntToStr(iMsg) );
//IdMsg->UID is empty (?)
if( !IdIMAP4->GetUID(iMsg,s) )
throw Exception( "!GetUID " + IntToStr(iMsg) );
}//for
t = ::GetTickCount()-t;
}catch( EIdException &e ){
return false;
}//catch( EIdException &e )
catch( Exception &e ){
return false;
}
double dt = (double)t/(double)nMsg;//252.53495873621098[ms]
My problem is the value of dt: it is greater than 250ms
Meaning that I can only get 4 headers per second - this is unacceptably slow.
Tested on different mail boxes of different accounts; PC is connected to inet with 200x20 plan.
Is there a way to call RetrieveHeader for more than just 1 message at a time?
Thanks in advance, and have a nice weekend. Boba TC.