I just thoght that there is a way to pass message to filter right before
passing it to mailbox_command, deliver in my case.
D.
1- if it's ok to filter mail if one of the recipient is local
(eventhough other recipients may belong to other domains), you can use
check_recipient_access:
content_filter =
smtpd_sender_restrictions =
check_recipient_access hash:/etc/postfix/filter
== filter:
example.com FILTER spamfilter:nexthop
2- otherwise, you need multiple postfix instance (run postfix twice) and
use transport_maps instead of content_filter.
In (1), a multi-recipient message is not split into local and relay
copies. it's passed to the filter as soon as one of the recipients is
local (is *...@example.com).
In (2), the message is split: one copy is sent to "local" users after
filtering. another copy is relayed without filtering.