This document describes how to configure hMailServer to act as a MX backup server for a domain hosted on another server.
In a DNS it is possible to configure a domain to have multiple mail exchange (MX) records. The different MX records have different preferences (also called priority). When a server tries to deliver an email to a domain on another server, it will first try to deliver to the host name in the MX record with the lowest preference / priority. If this fails, it will attempt to deliver to the second. If this fails, the third, and so on.
The e-mail servers running on the MX records with high preference can therefore be seen as backup mail servers - if the primary mail server fails to receive a message, the secondary / backup server may.
Please note that the term used here, backup mail server, only affects SMTP. If a delivery is made to the backup mail server and the backup mail server forwards the message to the primary server, the message will be deleted from the backup mail server when it has been successfully received by the primary server. So to download messages using POP3 or IMAP, users would always have to access the primary mail server.
Here's an example on how to set up a mail backup server for the domain hMailServer.com. There are two things which need to be made:
In this scenario, there are two mail hosts and servers involved:
Configuring the DNS
In the DNS, two records should be added. One for the primary server and one for the secondary. It's important that the preference value for the primary is lower than the value for the secondary. If a lower preference value is given to the backup server, all email will go through the abackup server.
Host | Preference |
mail.hmailserver.com | 25 |
mail-backup.hmailserver.com | 50 |
Configuring hMailServer
The sender of an email will first try to deliver to the primary server, in this case mail.hmailserver.com. If the delivery to this host fails, the sender will try to deliver to the backup server, mail-backup.hmailserver.com. The server mail-backup.hmailserver.com will then have to forward the email to mail.hmailserver.com whenever that server goes online. If the primary server does not come online within a specified amount of time, a bounce message will be delivered to the original sender saying that the message could nto be delivered.
The steps below show how to configure the hMailServer installation running on mail-backup.hmailserver.com to forward all email for the domain hmailserver.com to the host mail.hmailserver.com.