0 votes

Hi!
I'm trying to add Idle functionality to my application, but I'can't find a way to make the StopIdle method to work, or perhaps there's something else I'm missing.
I'm populating a TreeView with the directories, then go to the Inbox node, retrieve my messages and start the Idle for that Folder. At this point everything works fine, and I can constantly retrieve my new messages.
But as soon as I try to change the folder or close my app, it crashes.

imapClient.Idle():
"Tried to read a line. Only '' received. Please make sure that antivirus and firewall software are disabled or configured correctly"

How can I make the Idle function to work, or what's the appropiate way to do it?
Thanks in advance.
Edgar

by

1 Answer

0 votes

It is not possible to change folder while idling.

The only command that is allowed in this state is DONE command, which can be send using StopIdle method.

by (297k points)
Hi again.
My question was about the stopIdle method.
Before I try to change the folder, I'm using StopIdle(), but the Idle() method never finish.
Is there a problem if i use Idle() within a thread?
I just can't find a way to make it work.
Thanks in advance.
It's hard to say what you are doing incorrectly without seeing your code.

Generally if you plan to wait for server notifications you use Imap class instance from a background thread.

StopIdle method is the only method that is thread safe and can be invoked from a different thread than the Imap instance is using. In most cases StopIdle is invoked from a UI thread to stop background operations.
Ok, I've figured out my problem.
The thing is: StopIdle() doesn't makes Idle() to stop immediatly, so I had to wait for Idle() to finish its process and then change my current folder or do wathever thing I need.

I appreciate your help.
...