EmailFilter includes a Postfix policy service, so Postfix can ask it about each sender with no scripts. Senders with the verdict rejected get 550 5.7.1 Sender address rejected by EmailFilter. If EmailFilter fails or is too slow, the mail is let through.
-
Turn the service on in
.envand publish the port indocker-compose.yml(uncomment the10040line):EMAILFILTER_POLICY_LISTEN=:10040 -
Add it to
/etc/postfix/main.cf, afterreject_unauth_destination:smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service { inet:127.0.0.1:10040, timeout=10s, default_action=DUNNO } -
postfix reload
Your own users are let through by permit_mynetworks and permit_sasl_authenticated before EmailFilter is asked. Bounces, which have an empty sender, are always let through. The policy port has no authentication, so keep it on localhost or a private network.