IMAP proxy functionality is typically used not for high availability in failover clusters but rather to create horizontal scaling i.e. to distribute the mailboxes over multiple servers, with each server holding the accounts for specific users.
That will increase availability because if you have N servers, each holding 1/N of your total mailboxes only a fraction of users is impacted when a single server fails.
If you want high availability with multiple servers where each server will support every mailbox, the first thing you need to engineer how all servers can access and modify the same email stores, the Maildirs with the actual messages your users receive and send. (NFS, clustered file system, replication, a SAN etc. etc.)
Then you'll need to synchronise the accounts and passwords over all those servers.
Only then you can start to engineer failover (for instance with keepalived and/or HAProxy).
After you've done all that you'll learn that frequently HA clusters don't increase availability at all and that due to their complexity outages last longer and happen more frequently (in part due to operator error).