Michael Wener wrote:
Session 1 1 IDLE + IDLE Accepted <Some time passes and then new mail arrives> * N EXISTS * 1 RECENT
Session 2 <Ah Ha, I see I have new mail> 2 FETCH N BODYSTRUCTURE * N EXISTS * 1 RECENT 2 NO the specified message set is invalid
The line "Ah Ha, I see I have new mail" is incorrect. Session 1 has seen it has new mail, not session 2. From the server's perspective these might as well be different machines, so when session 2 attempts to fetch anything about message N the server (legitimately) rejects this request since the server hasn't told session 2 about the new message yet. In addition to rejecting this request the server now tells session 2 about the new message, so a subsequent fetch for this message will work. The bottom line is the server must tell each session (independently) about new messages (and anything else) - a single client that uses multiple connections must understand this. Assuming multiple sessions must be used, one possible solution is for session 2 to issue a NOOP when it "realizes" it has a new message so the server can tell it about the new message.
-Rick Block
