Using FEATURE(mailertable) one can instruct sendmail to route email for certain destination via a specific relay. A mailertable is essentially a static map that instructs sendmail where to route email for certain destinations ignoring DNS MX RRs (or other information). Example:
yahoo.com smtp:[server.example.com] yahoo.com.hk smtp:[server.example.com] yahoo.com.mx smtp:[server.example.com] yahoo.com.br smtp:[server.example.com] yahoo.com.cn smtp:[server.example.com] yahoo.com.sg smtp:[server.example.com]
Why would one want to do that? Your customers may have been hit by a botnet and as a result your outgoing mail server may have sent enormous amount of spam. Since most high-profile mail hubs use some kind of reputation scheme on the IP addresses that contact them, it is quite probable that your outgoing mail server is experiencing delays, or worse denied delivery despite the fact that in the meantime you have done your best to stop the botnet and clear your queues. I know for it has happened to me.
A mailertable is a quick solution to route email through another mail server just for recipient domains that implement such policies. But it is far from perfect for the Postmaster has no way to know all the domains that Yahoo! Mail in the above example hosts in order to construct a mailer table. Luckily, when high-profile mail hubs (like Gmail, Yahoo! Mail and Hotmail) implement good patterns on their DNS MX RRs, a programmatic (instead of a static) solution can be deployed:
LOCAL_CONFIG Kbestmx bestmx -T.TMP LOCAL_RULE_0 R$+ < @ $+ > $* $: $(bestmx $2 $: NOTFOUND $) $| $1 < @ $2 > $3 R$+.hotmail.com. $| $+ < @ $+ > $* $#esmtp $@ [server.example.com] $: $2 < @ $3 > $4 R$+ $| $+ < @ $+ > $* $: $2 < @ $3 > $4
In the above snippet, any email that is directed to a domain that is served by Hotmail’s servers is routed via server.example.com. For the record, our outgoing webmail server achieved a senderscore of 50, and although a filter stopped the plaque, Hotmail silently discarded email originating from it. Using the above solution restored communications for our users.