To use FEATURE(mailertable)
, you will have to
create an external database containing the routing information for various
domains. For example, a mailertable
file in text format might
be:
.my.domain xnet:%1.my.domain uuhost1.my.domain suucp:uuhost1 .bitnet smtp:relay.bit.net
This should normally be stored in /etc/mailertable
. The
actual database version of the mailertable is built using:
makemap hash /etc/mailertable.db < /etc/mailertable
The semantics are simple. Any LHS entry that does not begin with a dot matches the full host name indicated. LHS entries beginning with a dot match anything ending with that domain name -- that is, they can be thought of as having a leading "*" wildcard. Matching is done in order of most-to-least qualified -- for example, even though ".my.domain" is listed first in the above example, an entry of "uuhost1.my.domain" will match the second entry since it is more explicit.
The RHS should always be a "mailer:host"
pair. The mailer is
the configuration name of a mailer (that is, an `M'
line in the
sendmail.cf
file). The "host" will be the hostname passed to
that mailer. In domain-based matches (that is, those with leading dots) the
"%1"
may be used to interpolate the wildcarded part of the host
name. For example, the first line above sends everything addressed to
"anything.my.domain" to that same host name, but using the (presumably
experimental) xnet mailer.
In some cases you may want to temporarily turn off MX records, particularly on gateways. For example, you may want to MX everything in a domain to one machine that then forwards it directly. To do this, you might use the DNS configuration:
*.domain. IN MX 0 relay.machine
and on relay.machine use the mailertable:
.domain smtp:[gateway.domain]
The [square brackets] turn off MX records for this host only. If you didn't do this, the mailertable would use the MX record again, which would give you an MX loop.