Relay email based on Sender address / domain

classic Classic list List threaded Threaded
3 messages Options
VB
Reply | Threaded
Open this post in threaded view
|

Relay email based on Sender address / domain

VB
Hello All ,  Looking for a suggest

As most of you might have come across the need to route email based on
sender address / domain , we got into it as well and looking for help :

after some reading we tried to configure :

sender_dependent_default_transport_maps =
        hash:$config_directory/sender_dependant_relayhost_maps.db

in the main.cf file to achieve this .

with the maps layed out this way

sender_dependant_relayhost_maps.db >>

senderDomain1          smtp:Anti-Spam_Gateway1
senderDomain2          smtp:Anti-Spam_Gateway2


however the instance continues to deliver email via the internet route Vs
route via a GW .

i have not disabled transport_maps as we are using it to give direction to
incoming NDRs in a multi instance setup.

do these attributes conflict / override , or should a instance has only any
one of these configured.

+ should this be configured in master.cf Vs main.cf

please share anything that has worked for you .

Thank you ,



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Relay email based on Sender address / domain

Dominic Raferd


On Wed, 29 May 2019 at 03:36, VB <[hidden email]> wrote:
Hello All ,  Looking for a suggest

As most of you might have come across the need to route email based on
sender address / domain , we got into it as well and looking for help :

after some reading we tried to configure :

sender_dependent_default_transport_maps =
        hash:$config_directory/sender_dependant_relayhost_maps.db

in the main.cf file to achieve this .

with the maps layed out this way

sender_dependant_relayhost_maps.db >>

senderDomain1          smtp:Anti-Spam_Gateway1
senderDomain2          smtp:Anti-Spam_Gateway2


however the instance continues to deliver email via the internet route Vs
route via a GW .

i have not disabled transport_maps as we are using it to give direction to
incoming NDRs in a multi instance setup.

do these attributes conflict / override , or should a instance has only any
one of these configured.

+ should this be configured in master.cf Vs main.cf

As I read it, default_transport can be overridden by sender_dependent_default_transport_maps which can in turn be overridden by transport_maps.
JRC
Reply | Threaded
Open this post in threaded view
|

Re: Relay email based on Sender address / domain

JRC
In reply to this post by VB
Hi!!

> sender_dependent_default_transport_maps =
>         hash:$config_directory/sender_dependant_relayhost_maps.db

Here you should point to the plain text file, not the db. The db file should
be generated by running the postmap command:

# postmap $config_directory/sender_dependant_relayhost_maps


> however the instance continues to deliver email via the internet route Vs
> route via a GW .
>
> i have not disabled transport_maps as we are using it to give direction to
> incoming NDRs in a multi instance setup.

During the next hop lookup the transport_maps has priority over everything, so
if you have a wildcard there for example, your sender based configuration will
never be reached.

Cheers!