Multiple mail relays depending on sender's address

Since Ionos does not accept foreign sender addresses anymore I need to configure our home server to select a mail relay server depending on the sender address. Can somebody guide me how to do this using UCS 5.0-6 the standard way ?

Thanks in advance.

I found this thread very helpful in order to achieve this:

Works pretty well for me.

Yes, great. That did it.

Here step by step:

First create a file named /etc/postfix/smtp_sasl_passwd

@<senderdomain1.tld>  <username_relay1>:<password1>
@<senderdomain2.tld>  <username_relay2>:<password2>

Then create a file named /etc/postfix/sender_relay

@<senderdomain1.tld> <relay1.tld>
@<senderdomain2.tld> <relay2.tld>

Then locate /etc/postfix/main.cf.local and enter:

smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sender_dependent_authentication = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwd
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

Finally do the following commands:

ucr commit /etc/postfix/main.cf
postmap /etc/postfix/smtp_sasl_passwd
postmap /etc/postfix/sender_relay
systemctl restart postfix

Worked immediately. Thanks

1 Like

Glad to hear that this approach worked for you as well. :+1:

Mastodon