sender AND recipient based routing

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

sender AND recipient based routing

flymike
I have a requirement to deliver via 'X' when sender = 'A' /and/ recipient =
'B', else deliver via configured defaults.
I see how I could use sender_dependent_default_transport_maps to set nexthop
to 'X' when sender = 'A' but I still need to deal with the additional
condition that recipient = 'B'.
It's like I need multiple transport tables, dependent upon sender.
Is there any way to fulfill this requirement within the postfix framework?



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

Re: sender AND recipient based routing

Viktor Dukhovni


> On Feb 12, 2018, at 12:10 PM, flymike <[hidden email]> wrote:
>
> I have a requirement to deliver via 'X' when sender = 'A' /and/ recipient =
> 'B', else deliver via configured defaults.
> I see how I could use sender_dependent_default_transport_maps to set nexthop
> to 'X' when sender = 'A' but I still need to deal with the additional
> condition that recipient = 'B'.
> It's like I need multiple transport tables, dependent upon sender.
> Is there any way to fulfill this requirement within the postfix framework?

Not within a single Postfix instance.  With multiple instances (and much
complexity) you could use "sender A" select a different downstream instance,
where B is routed to the desired transport.  This scales poorly, but if the
exceptions are few enough, and the need great, then you can do it.

Another option is to use a proxy filter, or milter to rewrite B to some
special recipient address B' when the sender is A, then route B' to a
custom nexthop, and use smtp_generic_maps to transform B' back to B
on output.  This works in a single Postfix instance with a proxy filter
or milter.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: sender AND recipient based routing

flymike
Thanks, Viktor.
With the milter option, can I still use transport_maps to set the custom
nexthop?  I'm wondering if smtp_generic_maps are applied after or before
transport_maps?



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

Re: sender AND recipient based routing

Viktor Dukhovni


> On Feb 12, 2018, at 3:27 PM, flymike <[hidden email]> wrote:
>
> With the milter option, can I still use transport_maps to set the custom
> nexthop?

Yes.

> I'm wondering if smtp_generic_maps are applied after or before
> transport_maps?

Milters happen on input when messages are received, transport
lookups when messages enter the active queue, and smtp_generic_maps
(naturally) on output, in the SMTP delivery agent.

--
        Viktor.