On Mon, Jul 21, 2025 at 02:59:40PM +0200, Matus UHLAR - fantomas via 
Postfix-users wrote:

> > Otherwise, use check_policy_service with  custoim policy server
> > that returns FILTER commands to route the message.
> 
> postfwd works as policy filter, so it can do that.
> 
> Note that in order to know number of recipients, you must call postfwd from
> smtpd_data_restrictions or smtpd_end_of_data_restrictions

You left out the word "also", the policy service will need to be called
from smtpd_recipient_restrictions first, in order to count the
recipients, and then finally apply that count in the data phase.

Since this sounds like an MSA, one would typically have rules in place
that permit SASL authenticated users, ... and of course the recipient
counting would have to happen *before* these permits fire.

A milter may be able to count recipients and add a header with the
recipient count that could be used with milter_header_checks.  This
could be more reliable than careful staging/timing of policy service
callouts.

It would also have to be the case that none of the recipients are local,
the MSA would have to be essentially a null client, handing off *ALL*
mail to smarthost, since FILTER actions that select a remote SMTP server
would break that.

My advice is to try to avoid "clever" configurations of this sort.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to