Zimbra wrote their own IMAP server.
I think you're all misunderstanding what IDLE is. Here's how to use it manually. Things you type are in boldface. You can replace the first command with telnet mail.example.com 143 if your server doesn't require SSL.
And then the connection sits there. If the client wants to execute another command, or to ensure that the connection stays alive (30 minutes is a typical period), then it sends DONE. If the server wishes to notify the client of a new message, it sends the updated message count without waiting for the next DONE/IDLE refresh cycle.
openssl s_client -quiet -connect mail.example.com:993
* OK mail.example.com Zimbra IMAP4rev1 service ready
1 login Username@example.com Password
1 OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LITERAL+ LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN X-DRAFT-I00-LIST-STATUS] LOGIN completed
2 select inbox
* 4658 EXISTS
* 0 RECENT
* OK [UNSEEN 1999] mailbox contains unseen messages
2 OK [READ-WRITE] SELECT completed
If the client wishes to act on this information, it sends a DONE and fetches the new message(s).
* 4659 EXISTS
* 1 RECENT
When I speak IMAP to my 6.0.4 server, I see correct behavior. The untagged mesages are sent only for messages in the currently selected inbox folder.
Those of you seeing this problem with 6.0.5, please try this.
If your IMAP client, for whatever reason, had Junk selected before going IDLE, then Zimbra should and will notify it of new Junk messages. I recall that some IMAP clients keep multiple connections open to multiple folders in order to improve responsiveness. You should see evidence of this in mailbox.log.