Conditionnal relay in postfix

I use postfix to send direct email. But, I use a relay to send email for specific senders. So I use "sender_dependent_relayhost_maps" :

/etc/postfix/main.cf :

relayhost =
transport_maps = hash:/etc/postfix/transport
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay

/etc/postfix/sender_relay :

[email protected] smtp.relay.com

So when I send an email with sender email "[email protected]", postfix will use the relay.

But... I don't want to use the relay host for some recipient. ;)

I think I must use "transport_map" to catch the email before it pass through "sender_dependent_relayhost_maps" but I don't know how to do it...

Thanks


Solution 1:

Okay, I found the solution... :)

So in the main.cf I add, before "sender_dependent_relayhost_maps" :

transport_maps = hash:/etc/postfix/transport

And, in "transport" file, I just add :

domain.com smtp:

(nothing else after "smtp:" which significate that the smtp server will send directly the email)

Thanks anyway. ;)