> On Mar 2, 2019, at 3:39 PM, Andrey Repin <[email protected]> wrote:
>
>> Is it possible to set up Postfix so that it refuses to send outgoing email
>> with more than a certain number of CC'd addresses?
>
> Yes, it is possible, you can write a policy script that would do so.
> But mind you it would only create more trouble.
Actually a "policy script" (by I think you mean policy service) cannot
do this, because it does not get to see the message headers.
A crude approximation is possible with header_checks:
# A comma after a ">" is generally an address separator
# Allow at most 50 To: or Cc: addresses (each).
#
if /^(To|Cc):/
/(?:.*?[>]\s*,){49}/ REJECT Too many addresses in Cc: list.
/^/ DUNNO end of To/Cc rules
endif
More precise parsing is possible with milters or proxy filters.
--
Viktor.