Archived Forum Post

Index of archived forum posts

Question:

IMAP multiple concurrent connections to many email accounts?

Sep 08 '16 at 19:54

Does the IMAP library support multiple, concurrent connections to many email accounts?

We basically want to use the Idle() feature to monitor many email accounts (and mailboxes/folders within each account).

If so, do you have any thoughts on how many accounts could be monitored on a decent size server?


Answer

You can certainly have multiple IMAP object instances, each of which has it's own session, is logged on to a particular user account, etc. These would all be completely independent of each other. Also, assuming you write the application so that each IMAP session is managed by its own thread, then there's really no difference -- it's just a matter of knowing how to do multi-threaded programming in your particular programming language.

You might ask: Is it possible to service many email accounts w/ a single IMAP object instance in a single IMAP session? The answer is that there is nothing in the IMAP protocol for such a thing. Some mail servers might offer "shared mailboxes", and in that case the mailbox naming would follow some convention that's specific to that particular IMAP server implementation. From an IMAP protocol perspective, it's still just a single session with various mailboxes.