Linux Harbour

Technology News of Linux & Open Source

Linux

Postfix SMTP – How to setup an email relay system ?

Email relay is an email server which forwards incoming SMTP emails to an another SMTP server. Postfix can be setuped as an email relay.

First, you should ensure which domaisn are being forwarded (eg. domain-A-to-be-relayed.com and domain-B-to-be-relayed.net), and hostname of destination SMTP server which you expects emails for these domains forwarding to. (eg. destination_host of these domains).

Edit /etc/postfix/main.cf:

transport_maps = hash:/etc/postfix/transport
relay_domains = domain-A-to-be-relayed.com, domain-B-to-be-relayed.net

Edit /etc/postfix/transport:

domain-A-to-be-relayed.com   smtp:destination_host.domain-A-to-be-relayed.com
domain-B-to-be-relayed.net smtp:destination_host.domain-B-to-be-relayed.net

Regenerate the hash table and reload the Postfix daemon.

$ postmap /etc/postfix/transport 
$ /etc/init.d/postfix reload

Sammy Fung

Sammy is the founder of the Linux Harbour.