Tudor is a techie turned manager who fights like mad to keep his tech skills honed and relevant. Everything from web hosting, networking, *nix and the like. Constantly developing and co-ordinating with others to make the web a better (and easier to use) place.
Thursday, 18th Jul 2013 Posted @ 14:16
So then. I have lots of domains - ranging from gTLDs through to DynDNS supplied ones and lots of email accounts. This means that I get a lot (and by a lot, I mean a lot) especially as some of my email accounts have been running since 1996 (UUNet/Pipex).
I also have several VPS, a couple of hosted domains and my own servers with stuff hosted on them.
Anyhoo, what I really wanted was a single place where all my email would end up regardless of which domain it was sent to. So this is what I did:
Step 1
Setup postfix on 3 of my VPS'.
Configured each one with virtual_alias_domains and virtual_alias_maps (example below):
/etc/nginx/main.cf
virtual_alias_domains = example.com, example2.com, etc
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/nginx/virtual
@example.com [email protected]
@example2.com [email protected]
Run postmap against the virtual file and restart postfix.
Essentially I have (on all 3 servers) put a forward on all and any email for a domain to my gmail account.
Step 2
Create round robin DNS entries on at least 1 domain
A mx2.example3.com x.x.x.x
A mx2.example3.com y.y.y.y
A mx2.example3.com z.z.z.z
Step 3
Change the MX entries for every domain to point at mx2.example3.com
Thats it. Its completely fault tolerant - if one of the VPS' goes down or the company goes belly up, I just need to amend a single entry for mx2.example3.com but mail will continue to flow using any of the other servers that is still responding and all my mail ends up in a single place (gmail).
I just need to import my IMAP folders into Gmail and I am done :)