Thanks for your attention, guys, but here's my problem -
The messages (commit notifications) must be delivered to some recipients
but not the others. I don't have access to the headers in acl_smtp_rcpt and
in acl_smtp_data I can discard the entire message to all its recipients as
mentioned above by Mike.
This is all about outgoing mail. The recipients are not local and those I
need to block belong to a known customer domain.
I have some weird thoughts about routing mail to this domain through a
relay which would take care of the content filtering but it's too
complicated unless the mail can be somehow rerouted through that same MTA.
2017-04-05 18:06 GMT+03:00 Chris Siebenmann <cks@???>:
> > I need to discard mail from a known address to certain recipients IF the
> > subject matches a known string. I've tried to add
> >
> > discard message = The $sender_address is prohibited to send commit
> > notifications to these recipients
> > senders = <known address>
> > recipients = <recipient 1> : <recipient 2>
> > condition = ${if match{$h_subject:}{Commit}}
> >
> > to acl_check_data section of exim.conf but got an error:
> >
> > ... temporarily rejected after DATA: cannot test recipients condition in
> > DATA ACL
> >
> > What would be the correct way to accomplish this?
>
> People have already given you good information about doing all of
> this in the DATA ACL, so I'm here to suggest an alternate way: do this
> matching in stages. Instead of trying to match the recipients in the
> DATA ACL, where it's at least a bit awkward, check for the recipients in
> the RCPT TO ACL and set an ACL variable that you'll later check in the
> DATA ACL.
>
> Something like:
>
> warn
> local_parts = <recipient 1> : <recipient 2>
> set acl_m0_nocommit = 1
>
> Then later in your SMTP DATA ACL you can check $acl_m0_nocommit in
> your 'condition ='. This may be usefully simpler than trying to get
> regexp address matches right and so on, and as a bonus you can use
> all of the power of Exim's single-address matching operators here.
>
> (In general, any number of creative things are possible in ACLs if you
> split the logic over multiple ACL operations and pass information around
> through ACL variables. For example, we use this to determine the minimum
> level of SMTP time spam rejection that all of the message recipients have
> opted in to; the actual rejection happens in our SMTP DATA ACL, but we
> accumulate the information separately for each recipient in the SMTP RCTP
> TO ACL.)
>
> - cks
>