Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lazarus IMAP i got error
#2
(11-28-2023, 05:31 PM)eldonfsr Wrote:   if(IDIMAP.Connected=false) then begin;
    SetLength(SearchInfo, 1);
    SearchInfo[0].SearchKey := skUnseen;
    IDIMAP.UIDSearchMailBox(SearchInfo);
  end else begin
    SetLength(SearchInfo, 1);
    SearchInfo[0].SearchKey := skUnseen;
    IDIMAP.UIDSearchMailBox(SearchInfo);  // here is generated the error
  end;

You have an erroneous ; on the begin of your if statement (I'm surprised the code compiles at all). You need to remove that ;

if(IDIMAP.Connected=false) then begin; // <-- HERE

Besides that, you are executing UIDSearchMailBox() regardless of whether Connected is True or False.  The error message is telling you that are in the Authenticated state, which means you don't have a mailbox selected.  You need to select a mailbox before you can search its emails. There is no command to search an un-selected mailbox.

Reply


Messages In This Thread
Lazarus IMAP i got error - by eldonfsr - 11-28-2023, 05:31 PM
RE: Lazarus IMAP i got error - by rlebeau - 11-30-2023, 10:48 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)