Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Running a "DNS scan" to make sure my DNS zones are setup "correctly" led to the suggestion by the tool to run more than one mail server for redundancy. It got me thinking about how one would implement such thing.

Assume I have two mail servers, and MX1 has higher priority. Assume each server is located geographically apart from each other. For any configuration related answers, assume they are running Postfix. How would I configure my MTA (Postfix) to consolidate email received by both mail servers into one response for clients?

Take the following example: I send an email to myself and it is delivered to mx1. Now mx1 has some downtime and someone sends me an email, it is delivered to mx2. My mail client is setup to use IMAP and retrieves mail from mx1. In the above scenario, I would only be able to retrieve the email I sent myself as the second email is sitting on mx2. In order for me to read the second email, mx1 needs to know about it from mx2.

Is this something I need to configure in my MDA, or does postfix have some feature to handle this situation?

share|improve this question

closed as too broad by Sven, MadHatter, MichelZ, dawud, Katherine Villyard Apr 13 '14 at 15:17

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

This question is very broad (books have been written on the subject of how email servers work) and reads a lot like you're asking people to do your research for you. You may want to edit the question to ask some specific questions you have after reading up on things like MX records (if you've done enough work to know to tag the question as related to MX records then you should really know the answer to at least one of your questions). – RobM Apr 13 '14 at 9:00
My bad, totally forgot about priority levels for MX records, will remove that question + tag. – jduncanator Apr 13 '14 at 9:02
@RobM I've updated my question to be more specific. – jduncanator Apr 13 '14 at 9:10
Your model of how this works is not how this is normally done (save by the very largest providers, who do indeed have multiple points of final delivery - and infrastructures to support this that are way too complex for an SF question). Instead, mx2 also knows that mx1 is 1ary for mail, and holds mail received for your domain in queue until mx1 comes back, and it can deliver it on. – MadHatter Apr 13 '14 at 9:17
@MadHatter, so your saying you'd setup mx2 to relay email onto mx1? – jduncanator Apr 13 '14 at 9:20
up vote 3 down vote accepted

It's common practice to have more than one MTA facing the internet like this.

It's also fairly simple to 'consolidate' email from your internet-facing servers; you simply configure the 'backup' MX server to forward all the incoming email to the 'main' server which acts as the mail store your email clients connect to.

So if your email clients normally connect to then does nothing else other than forward email to MX1. If MX1 is unavailable then, like any other SMTP server, MX2 can queue email until MX1 becomes available.

Probably a more common scenario for busier systems is to have both these servers forward email to a 'back end' email store, which is what your clients connect to. This allows the internet-facing systems to be dedicated to processing incoming (and outgoing perhaps) email queues for spam filtering, malware scanning, etc. and also for these systems to be offline for patching (you want to patch vulnerabilities in internet-facing systems quickly right?) without affecting the service to your end users.

share|improve this answer
How would you distribute incoming email between internet facing MTAs in the malware scanning example you gave above? MX records with the same priority levels? Also, what would you suggest me searching to find information regarding forwarding emails to another email server? – jduncanator Apr 13 '14 at 9:28
@jduncanator yep, this is an example of load balancing by DNS Round Robin - as for forwarding emails, I'm not a postfix person so I can't answer that as well as others here can, but its a common enough configuration that I can't imagine it being difficult to dig out, all you're doing (if MX1 is your main server and mail store) is telling MX2 to forward all email for to MX1. – RobM Apr 13 '14 at 9:31
So basically, just setup mx2 postfix to relay all email to mx1? – jduncanator Apr 13 '14 at 9:34
@jduncanator I'd probably want to be more specific and say all email for rather then all email because you don't want it forwarding rubbish, but broadly speaking, yes. – RobM Apr 13 '14 at 9:35
If mx1 was down for long enough, yes, it would, and this is broadly desirable. You should tune the MTA on mx2 so it doesn't send them too early, though. And fix mx1 so it doesn't die so often! – MadHatter Apr 13 '14 at 10:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.