Auto sync of emails between 2 mail servers


As we ahev rather "unstable" broadband in South Africa, I always have 2 server running, on different networks, and located in 2 different geographical locations. Currently I have 2 mail account settings on all my customers Outlook. I would then manually change the default mail delivery location. This causes confusion with my customers. eg : account 1 POP3 : account 2 POP3 :

I need to know if there is a way to auto sync (via parameters etc) to dump / upload the mail that is on the "offline" server. The settings on both servers are indentical. It is just to much to go to each mail box using a tool like WinSCP, and then copy the mail over from the backup to the current active servers mail boxes.

Please advise.



Would this be a 1-way replication or 2-way?

For 1-way, you could do it using a cron job that backs up the domains on the source system and restores on the target, using the Virtualmin command-line API. See and

The down-side is that this would cause the full contents of each domain to be copied. Other than that, there isn't really any solution in Virtualmin.

Also, maybe a shell script that does some rsyncing of the mail directories would work.

Do your customers use POP3 or IMAP to fetch their mail? If POP3, then they download all incoming messages to their client boxes anyway, and do not access the server-stored ones, so IMO no server-side syncing is necessary really... Except for user accounts maybe, and emails that arrive in the timespan between "last email fetching by customer" and "system failure".

Otherwise, it might also be a solution to do the "syncing" on the SMTP level... Have both servers send incoming mails, in addition to storing them in the local users, to the respective other site. Needs some fiddling with Postfix delivery rules though to prevent loops and stuff. So just a basic idea for now. :)