I know we can use Nginx as a reverse proxy to forward traffics to multiple upstream server. Now I want to know how can I get such thing for email? I want to have an email gateway or email proxy to deliver the received emails to the proper email servers. something like the following pseudo code:
server {
listen 25;
server_name mydomain1.com;
forward to server mydomain1.com;
}
server {
listen 25;
server_name mydomain2.com;
forward to server mydomain2.com;
}
When the server receives info@mydomain1.com for instance, it delivers the email to server mydomain1.com and whenever the server (gateway) receives info@mydomain2.com it is forwarded to mydoamin2.com. mydoamin1.com and mydoamin2.com are the backend email servers. Which is the proper open source service can I use and configure for this purpose? Does apache james can be used as the gateway layer in front of multiple email servers?