S22.Imap icon indicating copy to clipboard operation
S22.Imap copied to clipboard

IDLE with Exchange 2007

Open GeNTooGeek opened this issue 13 years ago • 1 comments

I had trouble getting IDLE to work properly with my Exchange 2007 server. Whenever new messages arrived, e.MessageUID would always refer to the last email that was received before entering IDLE(before adding the NewMessage event handler). It didn't matter if I received 1 or 10 messages while in IDLE.

Doing some testing with Telnet, I noticed that if I ended IDLE "mode" and immediately requested STATUS INBOX (UIDNEXT), it always returned the same value as before entering IDLE. However, if I requested a SELECT INBOX before requesting the status, then I got the correct values. Looking in code, in SelectMailbox, you specifically do not re-select the mailbox, if it is already selected. I commented this out, and it is working properly with Exchange.

I haven't read the RFCs, but I suspect that the only drawback of re-selecting the same mailbox is the time and bandwidth for the request; if so, it may not be necessary to keep that "optimization". By far, your implementation, though, has been much less problematic than trying to use AE, which had a buggy ReadLine implementation(among other things).

GeNTooGeek avatar Jan 29 '13 22:01 GeNTooGeek

Hi and thank you for reporting!

I think it should be safe to comment it out. I'll do some more testing to be sure that nothing breaks and then push to master,

cheers, smiley22

smiley22 avatar Jan 31 '13 20:01 smiley22