Postfix Domain Relaying

Posted on Wednesday May 4th, 2016

Work has two external valid IPs with seperate mail servers listening. Today I needed to configure one of the mail servers to forward mail to the other (main) server while rejecting anything not for our domain.

The main entries to go in are:

# The domains that the server will accept mail for
relay_domains = $myhostname, hash:/etc/postfix/relay_domains
# The transport mapping for each domain
transport_maps = hash:/etc/postfix/transport

A sample entry for relay_domains is as follows, detailing the domains that we want to act as a relay for:    OK    OK

and a sample entry of the transport file:

As usual, the two files need to be converted to their db counterparts:

$ postmap relay_domains
$ postmap transport

Restart postfix for the changes to take place.

Credit where credit is due: