View Categories

Adding resiliency to Mailstore gateway by running an active backup server

2 min read

If the Mailstore Gateway server is unavailable Microsoft 365 servers will queue the journaled email for 24 hours. If you are concerned that you may have an outage longer than this then you can run a second Mailstore Gateway server to act as a backup should the primary fail.

Step 1 is to confirm you have a working MailStore gateway on your primary server

Step 2 copy the ‘%PROGRAMDATA%\MailStore\Gateway’ from the primary server to the same location on the secondary to replicate the configuration and journal mailbox address.

Step 3 As MailStore gateway is a free add-on so you can download a second copy and install on the secondary server, this over-install should pick up on the existing configuration you copied earlier.

Step 4  Within your DNS records you should create a second lower priority MX record for the Mailstore Gateway Domain you use to point to the secondary server

For example

If your mailstore gateway domain is ‘gateway.yourdomain.com’

You would create two MX records.

gateway.yourdomain.com MX preference = 10, mail exchanger = mail1.gateway.yourdomain.com
gateway.yourdomain.com MX preference = 20, mail exchanger = mail2.gateway.yourdomain.com

Then you would have two ‘A’ records resolving those two hosts names to the relevant Public IP addresses of the two servers..

mail1.gateway.yourdomain.com = 1.2.3.4
mail2.gateway.yourdomain.com = 2.3.4.5

Now when Microsoft servers try to deliver to the journal mailbox address it would usually deliver to the primary server, but if this was unavailable it would deliver to the secondary server instead.

Step 5 Within MailStore server configure a new ‘MailStore Gateway’ job to collect email from the new MailStore gateway server using the same settings as your existing mailstore gateway job only the host it collects from is different. You should set both jobs to run automatically every 600 seconds.

99.9% of the time  messages should only be archived via the primary MailStore Gateway server, but in the event that this fails the messages will start to arrive in the secondary server and this job will collect them.

As both jobs run all the time even when the primary server is back up and some messages arrive at both servers. Both jobs should collect and sort the messages as required, no manual intervention would be needed.