Postfix as a local relay

This can be used for situations where you have an internet facing machine (web server) and back-end machines (application server, database server, etc.).

In our examples, we’ll assume the following:
Internet facing web server IP is
Back-end database IP is
Back-end database IP is

On your Internet facing machine, edit /etc/postfix/ and add your back-end server IP’s to your mynetworks section or add a new one. For example:
mynetworks =,,

On each back-end machine, add the following to /etc/postfix/
relayhost =

Try sending an email using mailx. You should see the following in your mail log on each back-end server (Notice the relay line):
ADA08211D5: to=, relay=[]:25, delay=0.18, delays=0.05/0.02/0.09/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as CF54E21217)