Outbound Mail Relay

When a mail system does not have adequate connectivity or all of the information it needs to relay messages, it can forward them to another system that is in a better position for relaying. Consider the network in Figure 9-2 again. If the internal mail systems don’t have direct access to the Internet, they can’t deliver messages sent by the users in their subnets. They can, however, pass along all messages to the gateway mail system, which can make the deliveries for them. The following procedure demonstrates setting up Postfix on mail1.example.com to relay all messages it receives to gw.example.com, which can then make the outbound deliveries.

Before configuring the internal mail systems, make sure that the mail gateway is set up to permit relaying from the internal mail systems. The mynetworks parameter (see Chapter 4) should encompass the IP addresses of the internal mail systems, and if you use SMTP UBE restrictions (see Chapter 11), be sure to include permit_mynetworks among the rules to allow relaying:

  1. Check the mynetworks (or mynetworks_style) parameter to make sure it includes the client systems.

  2. Have the users in the workgroup configure their various mail clients to use mail1.example.com as their SMTP server.

  3. In main.cf, set the parameter relayhost to point to the gateway system:

    relayhost = [gw.example.com]
  4. Reload Postfix so that it recognizes the changes in its configuration file:

    # postfix reload

Now all messages delivered to mail1.example.com are relayed ...

Get Postfix: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.