If you have the luxury of two computers connected to the internet using different IP-addresses you could use one of them as your backup mailserver. This backup server will receive email for the domains on your primary server when it is off-line or unreachable.
First install and configure your backup server just like you would a regular server. Install the following components as a minimum (it’s best just to install everything when possible):
- MySQL, Apache and PHP
- The basic mailserver (postfix & courier)
When you’ve done that make the changes listed here on your intended backup server.
First you need to create a file in the directory ‘
/etc/postfix‘ called ‘
mysql_relay_domains_maps.cf‘, which should contain:
password = postfixpassword
hosts = 127.0.0.1
dbname = postfix
query = SELECT domain FROM domain WHERE domain=’%s’ AND backupmx = ’1′ AND active = ’1′
To make sure that mail does not get delivered to the backup server you need to change the file ‘
mysql_virtual_domains_maps.cf‘ in the directory ‘
/etc/postfix‘. Change the line:
Then add the line:
to the file ‘
main.cf‘ in the ‘
Then to activate the configuration restart postfix by using the command:
Go to your Postfix admin website and configure the domains you want to use. Basically you will configure this identically to your primary server. The only difference here is that you check the backup MX checkbox.
Finally you’ll need to add a record to your DNS entries. Make sure the priority for the backup MX is lower than the primary server. Here is how I entered the information for DIYMacServer:
mail.diymacserver.com 10 22.214.171.124
mail2.diymacserver.com 20 126.96.36.199