Re: [exim] Discard mail to certain recipients if the subject…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Chris Siebenmann
Päiväys:  
Vastaanottaja: Александр Кириллов
Kopio: Exim-users, cks
Aihe: Re: [exim] Discard mail to certain recipients if the subject matches a string
> 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