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

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Mike Brudenell
日付:  
To: Exim Users
題目: Re: [exim] Discard mail to certain recipients if the subject matches a string
Hi,

The error message seems pretty clear: you can't use the *recipients* condition
within an *acl_smtp_data* ACL. I assume this is because the recipients
condition tests the recipient currently being considered against the list.
However by the time you've got to an acl_smtp_data ACL there is no longer a
single current recipient; instead you've got the whole lot.

If that's right and I remember rightly, the $recipients variable can be
used in acl_smtp_data and contains a list of all the recipient addresses
form the envelope data, separated from each other with a comma and a space.
You can presumably iterate over this using *forany*, or might be able to do
something clever with *inlist* or *inlisti* instead.

A couple of other things to watch out for:

- Note that the *Specification* says it isn't possible to discard *some*
recipients in acl_smtp_data: you have to accept or reject the entire
message to *all* its recipients. So be aware that if a matching message
is sent to <recipient 1> and <recipient 3> then neither well receive it
(because your test says that <recipient 1> mustn't be sent it).

- Also watch out that the match operator's second argument is a *regular
expression* and is a *pattern*. In your example you don't tie the
pattern to the start and/or end of the expression, meaning it will match
with "Commit" anywhere in the Subject text — or example, "Shall I Commit To
This?" Are you intending this behaviour, or were you intending only to
match if the Subject text is exactly that string? (in which case use *eq*
or *eqi* instead of *match*)

Cheers,
Mike B-)

On 4 April 2017 at 16:11, Александр Кириллов via Exim-users <
exim-users@???> wrote:

> Hi list,
>
> 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?
>
> TIA
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/
>




--
Systems Administrator & Change Manager
IT Services, University of York, Heslington, York YO10 5DD, UK
Tel: +44-(0)1904-323811

Web: www.york.ac.uk/it-services
Disclaimer: www.york.ac.uk/docs/disclaimer/email.htm