On 2024-12-05 19:18, Jaroslaw Rafa via Postfix-users wrote:
> From what you have written I understand that in most (if not all) cases,
> each email has to be BCC-ed to "destination set", which consists of
> {B,X,Y,Z,S1+office,S2+office}. Only emails to S1 and S2 don't, they are
> BCC-ed only to B. Do I understand correctly?

Yes.

> So maybe you should try to use "recipient_bcc_maps" parameter for this,
> without the need for too much aliasing?
> 
> I think that recipient_bcc_maps for each of O,X,Y,Z can be the above
> "destination set", while the recipient_bcc_maps for S1,S2 would be just B.

AFAIK recipient_bcc_maps can have only one RHS, so I'd have to use alias
there. Reading man 8 cleanup it's not clear to me what's the exact order
of evaluation, I'd also have to use this alias for sender_bcc:

recipient_bcc:
        office  office_set
        X       office_set
sender_bcc:
        X       office_set
virtual:
office_set      B X Y Z S1 S2 [..]

As (long as) virtual doesn't contain X, Y, Z - there's no recursion
indeed. Interesting, I haven't used recipient_bcc_maps for years,
definitely worth practicing again.

> Probably O should be then aliased to something like /dev/null, as there is
> no actual recipient and all recipients are handled by BCC.

As *bcc don't redirect, but create a copy - yes, "original" office@
should probably be sinkholed.
OTOH I need to verify, that X +BCC: office_set containing X again would
be properly deduplicated.


If I understand this correctly, entire resolving is done in cleanup, and
due to the sole virtual _syntax_ I cannot terminate recursion and skip
delivery at the same time (as the former requires "aliasing to itself").

This is why I proposed explicit recursion-prevention flag.

But maybe I've been using recursionful feature instead of the better
suited one.

> bcc_recipient_maps is applied only once, and the recipients mentioned there
> don't get another copy of the same message ("To avoid mailer loops,
> automatic BCC recipients are not generated after Postfix forwards mail
> internally, or after Postfix generates mail itself.")
> 
> Can it solve your case?

It surely might, at first sight it could simplify several key components
of my actual setup. I'll have to experiment a bit with this to see if it
doesn't clash with something else I'm using, but it looks promising.

Using virtual to define *final* distribution lists under some "labels",
which in turn are used in *bcc might be the separate step I've been
missing and combined with Viktor's insight I hope will do the job.


Thanks again!

PS. sorry for breaking threading with my previous response.
-- 
Tomasz Pala
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to