email An email server on each VPS
Sorry, I misinterpreted your post as asking about serving multiple domains from one server but you want to run multiple mail servers from a single IP. It may be possible, though I don't have experience doing it so I can't offer tested configuration details.
DNS: The MX record for all domains would need to point to your public IP. Also, set up "mail.domain" for each domain to point to your public IP too.
Receiving: MX records do not contain port numbers so you can only accept mail on the standard ports which of course can only be forwarded to one VM. You'd need to configure your existing Postfix to accept all domains' mail and then forward to the other VMs via their private IPs where their Postfix instances would accept it. This aspect of it is the least familiar to me but email is meant to hop between servers so I'd be surprised if it couldn't be done.
Check out Postfix email firewall/gateway, specifically these lines:
12 transport_maps = hash:/etc/postfix/transport ... 19 /etc/postfix/transport: 20 example.com smtp:[inside-gateway.example.com]
The description says "Route mail for example.com to the inside gateway machine. The [] forces Postfix to do no MX lookup."
I think that will solve the forwarding-to-internal-VM problem.
Sending: This will be fairly straightforward as it'd be handled by your VM and you'd just need to add the other domains as valid relays to your Postfix's relay_recipients config file.
IMAP: This can be accomplished by allocating each domain its own port to forward at the router. Yours would be on 143, the next VM might be 144, then 145, etc. Each would forward to port 143 on their respective VM. You'd have to tell each user which port their domain's IMAP is running on so they can configure their mail client with "mail.mydomain.com:145", for instance.
One of the great things about email is that its infrastructure consists of many distinct pieces and they are all meant to handle complex configurations. I'm sure you can get this working.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now