Adding a Mail Destination

2.5.1 Problem

You need to add a mail destination to DNS.

2.5.2 Solution

Add one or more MX records to the zone that contains the domain name of the mail destination. The MX records specify the mail server or servers that accept mail addressed to that mail destination. Each MX record requires a preference value that tells mailers sending mail the order in which to contact the destination's mail servers. The lower the preference value, the more preferred the mail server.

For example, to tell mailers to send mail addressed to foo.example (such as an email message addressed to hostmaster@foo.example) to, and only if isn't up or isn't accepting connections, add these MX records to the foo.example zone data file:

foo.example. IN MX 0
foo.example. IN MX 10

2.5.3 Discussion

The preference value is an unsigned, 16-bit number, so between 0 and 65535. The magnitude of the number isn't important: the preference value doesn't represent any particular units. What's important is that the preference values for a domain name's MX records, taken together, tell a sending mailer the order in which it should use the destination's mail servers.

Most mailers will spread the load randomly among mail servers listed at the same preference value. This can come in handy with popular mail destinations: You can list a number of mail servers at the most preferred preference value and sending mailers will distribute the delivery of your mail among those mail servers.

The mail server must be specified as a single domain name, not an IP address. If you use an IP address on the right side of an MX record, mailers -- expecting a domain name there -- will try to look up the IP address as a domain name. This causes unnecessary queries to the root name servers, and fails to return an IP address, anyway.

It's up to you (or your fellow postmasters) to configure the mail servers to accept mail addressed to the destination. Make sure the most preferred mail exchangers understand that the mail destination is local, and make sure less preferred mail exchangers are configured to relay mail addressed to the destination.

2.5.4 See Also

RFC 2821 for authoritative information on SMTP and use of MX records, and Chapter 5 of DNS and BIND.

Getting Started

Zone Data

BIND Name Server Configuration

Electronic Mail

BIND Name Server Operations

Delegation and Registration


Interoperability and Upgrading

Resolvers and Programming

Logging and Troubleshooting


DNS & BIND Cookbook
DNS & BIND Cookbook
ISBN: 0596004109
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Cricket Liu © 2008-2020.
If you may any questions please contact us: