2019-12-15 01:23:15

Postfix sender based routing.

If you want to use a more fine-grained model you can choose to relay the outbound traffic for domains over separate users. This allows you to apply different settings per domain, but also provides the enduser access to their own logfiles.

Create sasl_passwd file for the individual outgoing user(s):
@example.com outgoing@example.com:THEPASSWORD

Create the sender_relay file
@example.com [SMARTHOST1]:587
@example.net [SMARTHOST2]:587

Postmap both files:
postmap /etc/postfix/sasl_passwd
postmap /etc/postfix/sender_relay

Add the following part has to be added to your main.cf:
relayhost = [SMARTHOST]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

Please note the above extract also configures serverwide, to also filter those that are not added on the sender_relay file. If you do not want this and only want to filter specific domains remove the relayhost line from above

Restart postfix.

Yazan caylakpenguen | Kalıcı Bağ