Routing non-local mail to a mailhub

Sometimes it is convenient to configure the MTA to route mail not for the local host, or a group of local machines, to a central machine and  leave it up to that machine to deal with the mail, perhaps relaying it  to the outside world or other local machines, or perhaps even  gatewaying it into other mail systems. The following example configuration, Routing messages to a central system, illustrates doing just this.

In this example, the local host is host1.domain.com and two other local machines, host2.domain.com  and host3.domain.com, are recognized. Mail for either of those two machines is sent via a     channel (SMTP over TCP/IP) to those  hosts. All other mail not for host1, host2, or host3 is sent via another SMTP over TCP/IP channel, named , to the host  mailhub.domain.com. A "match-all" rewrite rule  is used to  direct all mail not for host1, host2, or host3 to that channel. The   channel option is used with the   channel, telling the channel to  routed messages queued to it through the host mailhub.domain.com. For additional discussion of such usage, see also Routing via gateway systems.

A legacy configuration example of routing to a central system would be:  ! ! Rewrite rules for the local host/cluster ! host1                            $U@host1.domain.com host1.domain.com                $U@host1.domain.com ! ! Rewrite rules for some internal systems ! host2.domain.com                 $U%host2.domain.com@TCP-DAEMON host3.domain.com                $U%host3.domain.com@TCP-DAEMON ! ! Use a match all rewrite rule to route everything ! else to the mailhub.domain.com ! .                               $U%$H@mailhub.domain.com$A l host1.domain.com tcp_local smtp single_sys mx TCP-DAEMON tcp_gateway smtp mx daemon router mailhub.domain.com

See also:
 * daemon Option
 * Typical TCPIP channels and servers
 * A rule to match any address
 * Routing via gateway systems