Business Machine

Technology, business
and innovation.

And, not least, about
the Mac.

Weblog Archive Cutedge

by: Bernard Teo

Creative Commons License

Copyright © 2003-2012
Bernard Teo
Some Rights Reserved.

Thu 24 May 2007

Mail Servers and DNS

Category : Technology/MailServersAndDNS.txt

James Keating wrote me a question :

Can we run two (or more) mail servers for a single domain?

The answer is not a simple yes. Neither is it a no. And this had set me thinking. I reproduce my answer below in the hope that this can help other people understand mail servers better, as well as their relationship with the domain name system.

Usually you run one mail server for a single domain. You can have other mail servers for that domain, but these are used as backups that will get the mail when the primary mail server is down.

Start with the simplest case, where you have one mail server for the domain and this mail server sits on the machine you reach by typing its domain name. For example, sits on and the mail server is also on that machine, on IP address In this case, you don't even need to create an MX record.

Second case, where the mail server sits on a different machine from the machine known as For example, the mail server sits on a machine with an IP address of, reachable via a host name called Then you need to have an MX record in the Domain Name System to declare that is performing the function of the mail server for the domain,

In DNS Enabler, this is specified as

Hostname                 IP                   Alias       MX[10]

or, simply,

Hostname                 IP                   Alias       MX[10]

because, if you leave out the domain name after the square brackets, DNS Enabler assumes that you're referring to the primary domain,

This is what happens when someone sends a message to The originating mail server will check if there is an MX record for the domain, If there is, it will follow that record and know that it has to send the message to the machine,, which is acting as the mail server for that domain. If there isn't an MX record, it will send the message directly to the machine,

Third case, where you can have more than one mail server acting as mail servers for that domain, but these are secondary mail servers acting as backups for the primary mail server.

For example, if on IP address is the backup mail server for, for the domain, then we will denote its status as a backup by setting it with a higher MX number :

Hostname                 IP                   Alias       MX[10]       MX[20]

This is what happens when an originating mail server tries to send a message to and finds that the primary mail server is down. It will look up the MX records for the domain and see if it can find the next higher-numbered MX record to send the message to. If this is also down, it goes on down the line to the next record until it either succeeds in sending the message or fails entirely.

Fourth case. We can have another mail server, not acting as mail server for the domain, but acting on its own right :

Hostname                 IP                   Alias

In this example, this mail server is reachable only by machines on the internal private network, and it can be used as an outgoing smtp server for any mail client on the internal network.

However, in this case, if we're using the MailServe setup panel, we must take care to enter into the Domain Name field, rather than, otherwise the Postfix running on will mistakenly hang on to all mail destined for users on

There is a fifth case, where acts as the mail server for another host machine entirely, say,

For completeness, this is how we set up DNS Enabler :

Hostname                 IP                   Alias       MX[10]

and then the Domain Name field in MailServe should be set as, but I think your eyes are all glazed over by now and I'd better stop.

All this is to say that our little programs, MailServe and DNS Enabler, can actually do a heck of a lot. Hope all these make sense.

Posted at 1:24AM UTC | permalink

Put your Mac to Work Now how would you do something like that?

Weblogs. Download and start a weblog of your own.

A Mac Business Toolbox
A survey of the possibilities

A Business Scenario
How we could use Macs in businesses

VPN Enabler for Mavericks

MailServe for Mavericks

DNS Enabler for Mavericks

DNS Agent for Mavericks

WebMon for Mavericks

Luca for Mavericks

Liya for Mountain Lion & Mavericks

Postfix Enabler for Tiger and Panther

Sendmail Enabler for Jaguar

Services running on this server, a Mac Mini running Mac OS X 10.9.2 Mavericks:

  • Apache 2 Web Server
  • Postfix Mail Server
  • Dovecot IMAP Server
  • Fetchmail
  • SpamBayes Spam Filter
  • Procmail
  • BIND DNS Server
  • DNS Agent
  • WebDAV Server
  • VPN Server
  • PHP-based weblog
  • MySQL database
  • PostgreSQL database

all set up using MailServe, WebMon, DNS Enabler, DNS Agent, VPN Enabler, Liya and our SQL installers, all on Mavericks.