IMAP Proxy is a caching IMAP proxy server program. It was written to compensate for webmail clients that are unable to maintain persistent connections to an IMAP server. Most webmail clients need to log in to an IMAP server for nearly every single transaction.
This behaviour can cause tragic performance problems on the IMAP server. imapproxy tries to deal with this problem by leaving server connections open for a short time after a webmail client logs out.
When the webmail client connects again, imapproxy will determine if there's a cached connection available and reuse it if possible.
How does imapproxy keep track of which server connection is for which user?
Upon the first successful login to the real IMAP server (through the proxy), imapproxy fills in a little record that contains the username, an md5 digital signature of the password and the server socket descriptor that's being used.
After you log out and then log back in again, imapproxy just has to find a record that matches your username and password. These records are stored in a hash table (with the username being the hash key) in memory, so the lookups are pretty fast.
Can IMAP Proxy support multiple backend servers?
If you want IMAP Proxy to be able to proxy to multiple backend IMAP servers, you can run multiple instances of IMAP Proxy and make sure each instance is looking at a different configuration file.
Before you do this, take a look at perdition which appears to have been designed with this specific task in mind.