HAProxy community

Two mail servers

I did not find how you can proxy mail to two different mail servers. Is it possible to do this?
Example: mail1@example.com
belongs to server1
and mail2@examle.com belongs to server2
server1 postfix
server2 exchange

I just responded in the other thread, no, it’s not possibile with haproxy:

Haproxy is not the right tool for this job.

You need an SMTP relay (smarthost) capable of determining which host a destination mailbox resides on. If you had two such relays, you could use haproxy to load balance them, I suppose.

I tried a lot of options, unfortunately none of them works.

Unless you mean you’ve tried a lot of haproxy options–in which case, it can’t work–you need to be looking at changing the configuration on each of your existing mail servers so each is aware of which mailboxes reside on the other server. Look into Exchange “shared domain” documentation, for example.
You’ll need similar functionality in Postfix. A shared source of this information (such as A/D or LDAP) will lighten the administrative burden considerably, but would require significant complexity to set up.
Either way, this is completely out-of-scope for HAProxy and you should be looking for help for your MTAs in the usual places, or engaging a consultant with expertise in hybrid e-mail environments.

Большое спасибо, именно о диспетчере каталогов я и подумал.

Попробую организовать центральное управление пользователями на
основе OpenLDAP.

Еще раз большое спасибо.

Thank you very much.