Incoming mail: check senders
Copy scripts/emailfilter-check.sh to /usr/local/bin/ and make it executable. It needs curl and jq, exits 1 for a rejected address and lets mail through when EmailFilter cannot be reached. Then add this near the top of acl_check_rcpt:
deny
!senders = :
!hosts = +relay_from_hosts
condition = ${if eq{${run{/usr/local/bin/emailfilter-check.sh $sender_address}{ok}{rejected}}}{rejected}}
message = Sender address rejected by EmailFilter
With an API key or another address, set EMAILFILTER_API_KEY and EMAILFILTER_URL (default http://127.0.0.1:8000) in the environment Exim runs commands with.
Outgoing mail: check recipients
To stop your own users from sending to addresses EmailFilter rejects, add a router before your remote delivery router (usually dnslookup or smarthost):
emailfilter_verify:
driver = redirect
domains = ! +local_domains
condition = ${if eq{${run{/usr/local/bin/emailfilter-check.sh $local_part@$domain}{ok}{rejected}}}{rejected}}
allow_fail
data = :fail: Recipient address rejected by EmailFilter
The router only runs for rejected addresses and fails them with the message given; every other address goes on to the next router. Send a test message and look for the rejection in /var/log/exim4/mainlog.