Mail Server Design | Part-3 | Primary and Secondary Mail Server

In this design, we are going to describe primary and secondary mail server or MX server, this is very common scenario. Whenever I asked for a failover scenario to the community, this design comes to the table 90% time. This is very popular design among sys admins. It slightly reduces the single point of failure scenario. Though, solely we cannot depend on this design for mail server failover, because, here we said MX server that means it’s all about Incoming mail operation. This design is not applicable for outgoing server.

Why this design?

Our intention is to provide MX server failover, if primary server goes down, secondary server will receive all email, so that during primary sever downtime we don’t lost a single email.

How this Design Actually Works:

In this design, Our Primary server is performing full email operation for the Organization, it is not only a MX server but also our outgoing server, email Storage, POP/IMAP and Webmail server. So organization’s total email Operations performed by the Primary one. If the Primary server goes down, the secondary server will receive all email. But it will not provide any other services. Normally Email delivery is of two type’s local delivery and remote delivery, Primary server will receive mail for local Delivery because it has all the users’ information and inboxes to deliver. The Secondary server, on the hand, will receive mail only on crisis time, it will receive mail and stores at the ‘mail server Queue’ for remote delivery, because this sever will not contain any user information, neither inboxes to deliver, it will wait for the Primary server to come alive and then deliver all the queued emails to the primary server.

Design Preparation:

1. here we have 2 sever named   “” and “” both must have public IP and connected to internet.

2. These both system must be able to receive mail from internet, that’s why we have to Setup MX record at our Domain’s DNS server, we are assigning multiple server to receive mail, that’s why we have to assign MX with different Priority value, though, we can set same Priority to both server but that is a Load balancing scenario, I will describe that at later article, Here in this design, MX priority is the main issue, Let’s say   Priority  10   Priority  20

This Priority value means, whenever sender’s mail server asks for our domains mail server address, our DNS server will respond with above 2 server name and with the priority value, it will deliver the mail to the Lowest Priority Server, this is the rule for the mail servers, if primary server is down, then the sender will deliver mail to the Backup Mail Server Or Higher Priority mail server.

Let’s See Another Primary and Backup Mail Server Scenario:

This design is more practical than the previous one, because most office environment doesn’t provide 2 dedicated server for mail sever deployment, in this design, our backup MX server is in ISP environment, most ISP company or Mail service/Hosting Providers  Provide Email Services, we can take some space from them to store our email on temporary basis, we can also rent a dedicated VPS from them to store our email for this temporary period.

Backup MX Mail Storage Concept:

Regarding Storing mail at Backup Server, we have 2 Option’s, either we can configure Backup MX to Store Email at its Queue, Or we can Store emails to its Storage Directly, if we want to store email on Backup MX Storage, we have to configure server with a configuration called “Domain Catchall Address” , which will receive all email and store on a single common email address for the whole domain, all recipients mail will be saved on this single mail inbox at the backup server, in this scenario, Backup server will not try to deliver mail to Primary one when alive, it will be Primary servers responsibility to pull all email from that Remote Mailbox, and deliver to the local users inbox. On Linux Environment this type of setup is done with 2 known email program name “fetchmail and procmail”, i will try to show you later this configuration.

To understand the article more clearly Please watch the video.

One response to “Mail Server Design | Part-3 | Primary and Secondary Mail Server”

Leave a Reply

Your email address will not be published. Required fields are marked *