Advanced relay with Postfix

What's that?

Sender-based relaying is something very nice. More information can be found in the manual1)

Let's start

Here I want to show how to achieve that only certain receipient adresses are relayed. The rest of the mails should still be sent direct-mx 2) If you as the sender have a dynamic address it's probably wishful to send most of the mails direct-mx and only define exceptions for domains you know where direct-mx from a dynamic IP would NOT work. You could send all the mails via external relays, which might be an „overkill“ if you removed your IP address from several black lists 3). I know from that they use a dynamic filter which makes it impossible to send direct-mx to them. As well as gmx with activated spamfilter settings.


In transport the next hop for a mail based on receipient domain is defined. Domains not listed here will still receive mails direct-mx (I get about 90% of my mails to the servers using direct-mx for the rest I use relays)
Open/create the file transport in postfix directory (/usr/syno/mailstation/etc) and add an entry like the following (ex smtp:[myProvider.tld]

After that use postmap to convert the file to a postfix readable format

/usr/syno/mailstation/sbin/postmap /usr/syno/mailstation/etc/transport

and add the following line in

transport_maps = hash:/usr/syno/mailstation/etc/transport

and after that

/usr/syno/mailstation/sbin/postfix reload

after that mails for will be sent via the relay server. The rest will still be sent direct-mx

External Authentification

If this external server requires an authentification

smtp_sasl_password_maps = hash:/usr/syno/mailstation/etc/sasl_passwd

define the path to login credentials

[myProvider.tld]      myUser@myProvider.tld:meinPasswort

and use postmap and postfix reload


Melden Sie sich an, um einen Kommentar zu erstellen.