I l@ve RuBoard Previous Section Next Section

2.5 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 mail.foo.example, and smtp.isp.net only if mail.foo.example isn't up or isn't accepting connections, add these MX records to the foo.example zone data file:

foo.example.    IN    MX    0 mail.foo.example.
foo.example.    IN    MX    10 smtp.isp.net.

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.

    I l@ve RuBoard Previous Section Next Section