> On 1 Feb 2021, at 16:12, Viktor Dukhovni <postfix-us...@dukhovni.org> wrote:
> 
> On Mon, Feb 01, 2021 at 03:43:55PM +0100, Gerben Wierda wrote:
> 
>>> Yes, at the cost of a dedicated transport whose master.cf entry contains
>>> an override for smtp_generic_maps:
>>> 
>>>   master.cf:
>>>       mycanon unix ... smtp
>>>           -o smtp_generic_maps=$mycanon_generic_maps
>>> 
>>>   main.cf:
>>>       transport_maps = inline:{ {example.com = mycanon:} }
>>>       mycanon_generic_maps = inline:{ { @$myorigin = myal...@mydomain.net } 
>>> }
>> 
>> Sorry for my dimness (not doing this daily) but do I understand this 
>> correctly as:
>> 
>> - Message is deliverd to normal transport (smtp process A) first
> 
> No, absent prior content_filters that apply to all messages regardless
> of recipient domain there's only one delivery, via the transport 
> specified in transport_maps.
> 
> Perhaps you're confusing incoming messages via smtpd(8) with
> a delivery transport.  The Postfix concept of transport is
> an output-only concept.  The smtpd(8) service is incoming mail.
> 
>> - transport_maps in main.cf says: “when recipient is example.com 
>> <http://example.com/>, use transport mycanon)
> 
> That's the one and only transport.
> 
>> - Message is delived to mycanon transport (smtp process B) from normal 
>> transport (smtp process A)
> 
> No, the queue manager routes the message directly to the
> correct transport for each batch of recipients sharing
> the same nexthop destination.
> 
>> - mycanon transport replaces myorigin with the alias
> 
> Correct.

As I said, I’m dim. And worried that I’l be breaking my setup. So I want to 
really understand this, before I do anything.

I already have a filled transport_maps, 

transport_maps = hash:/opt/local/etc/postfix/transport

it contains entries like:

wierda.net                      smtp:192.168.2.66:25

(wierda.net is a virtual domain hosted on this mail server).

master.cf contains the standard:

smtp      unix  -       -       y       -       -       smtp

So I guess, I’ll have to add something to /opt/local/etc/postfix/transport 
instead overruling the whole thing inline.

Summing it up:

master.cf gets:

mycanon      unix  -       -       y       -       -       smtp
     -o smtp_generic_maps=$mycanon_generic_maps
smtp      unix  -       -       y       -       -       smtp

/opt/local/etc/postfix/transport gets an extra line:

example.com                      mycanon:

main.cf gets:
      mycanon_generic_maps = inline:{ { @$myorigin = myal...@mydomain.net } }

Result:
qmgr (or is it trivial-rewrite that handles transport_maps in some way and 
passes that on to qmgr?) uses transport_maps to pass the message to example.com 
<http://example.com/> on to the 'smtp with the -o flag’ process
the 'smtp with the -o flag’ process uses the content of smtp_generic_maps to do 
the sender address rewrite from <whatever> to myal...@mydomain.net 
<mailto:myal...@mydomain.net>

Correct?

Yours,

G

Reply via email to