Re: [exim] acl filter variable syntax

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Michael F. Egglestone
Datum:  
To: exim-users
Betreff: Re: [exim] acl filter variable syntax
Todd Lyons <tlyons@???> writes:
#There is no contains{} function provided by exim so I assume you were
#just using pseudo-code.

Thats correct. :)

# The and{} function requires you to group your
#functions differently:
#
#${if and{ \
#            {def:header_X-FC-System:} \
#            {${lookup{$h_Return-Path:}lsearch{/etc/exim4/listofnames}}} \
#       } \
#    {yes} \
#    {no} \
#}
#
#The "yes" and "no" are implied, so you could just shorten it to:
#${if and{ {def:h_X-FC-System:}{${lookup{$h_Return-Path:}lsearch{/etc/exim4/listofnames}}}
#} }


I'm getting closer.
Here's what works so far:

condition = ${if and{ {def:h_X-FC-System:}{match {$h_To:}{usera@???} }}}

My goal is to have a .txt file of email addresses, something like:

# cat /etc/exim4/listofnames.txt
usera@???
userb@???
userc@???

And I want my ACL to to look at the text file, and if it finds any of those addresses in the To: header, AND, the X-FC-System header exists,
then discard the email. So far I can only hard code an email address into the condition line.

If I try the condition = with the lsearch, I get an error:

discard
    log_message = Email blackholed
     condition = ${if and{ {def:h_X-FC-System:}{{match {$h_To:}lsearch{/etc/exim4/listofnames.txt}} }}}


and here's the mainlog error when an email is sent:

temporarily rejected after DATA: failed to expand ACL string "${if and{ {def:h_X-FC-System:}{{match {$h_To:}lsearch{/etc/exim4/listofnames.txt}} }}}": condition name expected, but found "{match {$h_To:}l" inside "and{...}" condition

I'm not sure how to use "match" or "lookup" or "lsearch" properly. ;)

Cheers,
Mike