indy tidimap4 on IdImap.SelectMailBox('INBOX') take longer lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- eldonfsr · 2023-10-26 17:37 Hi friends just i testing indy tidimap4 but when i selectMailBox take longer about 5 minutes is normal take longer or i can do something to not take longer UseTls: utUseExplicitTLS      SLL version. tslv1, v1_1,V1_2 Port: 143 when i conncet 993 pport send error... host: netsol-imap-oxcs.hostingplatform.com Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TFormMain.FormShow(Sender: TObject);Var FolderList: TStringList;    UnRead,MsgDownl:Integer; //   TEmails:TIdMessageCollection ;begin  Path:= ExtractFilePath(Application.ExeName);   if( FileExists(Path+'Datas\emailacct.dat')) then begin    BDAcct.FileName:= Path+'Datas\emailacct.dat';     BDAcct.ReadOnly:=false;    if( BDAcct.Active = false) then begin      BDAcct.Open;    end else begin       BDAcct.Open;    end;    BDAcct.First;    if( not BDAcct.eof) then begin      IdIMAP.Host:=BDAcct.FieldByName('emailsrv').AsString;      IdIMAP.Password:=BDAcct.FieldByName('password').AsString;      IdIMAP.Port:=BDAcct.FieldByName('EmailSrvPort').AsInteger;      IdIMAP.Username:=BDAcct.FieldByName('EmailAcc').AsString;      SMTP.Host:=BDAcct.FieldByName('smtpsrv').AsString;      SMTP.Password:=BDAcct.FieldByName('password').AsString;      SMTP.Port:=BDAcct.FieldByName('smtpSrvPort').AsInteger;      SMTP.Username:=BDAcct.FieldByName('EmailAcc').AsString;       IdSSLIOHandlerSocketOpenSSL1.Host:=IdIMAP.Host ;      IdSSLIOHandlerSocketOpenSSL1.Port:=IdIMAP.Port;      AcctType:=BDAcct.FieldByName('TypeAccount').AsString;      try        if( AcctType='IMAP') then begin          IdImap.Connect();          if( (IdImap.Connected=true)  ) then begin            IdImap.SelectMailBox('INBOX');            MsgCnt:=IdImap.MailBox.TotalMsgs;            iDimap.Retrieve(MsgCnt, IdMsg);            unRead:=iDimap.MailBox.UnseenMsgs;            MsgDownl:=(MsgCnt-Unread);            BDAcct.Edit;            BDAcct.FieldByName('MsgCnt').AsInteger:=MsgCnt ;            BDAcct.post          end;        end;       finally        ShowMessage('Can not connect to server');        IdImap.Free;        Application.Terminate;      end;     end else begin       if( not Assigned(FormNewAct)) then begin          Application.CreateForm(TFormNewAct,FormNewAct);       end;       FormNewAct.ShowModal;     end;   end else begin       BDAcct.CreateDataset;       BDAcct.FileName:= Path+'Datas\emailacct.dat';        BDAcct.Open;        if( not Assigned(FormNewAct)) then begin          Application.CreateForm(TFormNewAct,FormNewAct);       end;       FormNewAct.ShowModal;   end;end; ---------------------------------------------------------------------- Remy Lebeau · 2023-10-27 18:07 Quote from: eldonfsr on October 26, 2023, 07:37:05 pmwhen i selectMailBox take longer about 5 minutes Unless you are connected to a really slow server, or the server's SELECT reply is malformed, then the only other way I can see SelectMailBox() taking so long is if you have the TIdIMAP4.RetrieveOnSelect property set to either rsHeaders or rsMessages, thus causing SelectMailBox() to download all of the headers/content in the newly-selected mailbox.  RetrieveOnSelect is set to rsDisabled by default so SelectMailBox() will just select the mailbox and not download anything else from it.