Exim filter - negate a value, not a condition
Hello,
I wish to, in Exim, to use a filter, that will check emails being sent, in all the fields of to/cc/bcc, so I use the $domain variable.
I wish match a delivery to any domain that is not the local domain, hence being sent outbound.
In my test I send only to one email address at gmail.com.
If I use:
if $domain does not contain "mydomain.com"
It works great, but only if in all the above fields, there is no recipient that is to/cc/bcc to mydomain.com.
Once there is at least once a recipient that is using mydomain.com - this filter doesn't work, of course, because the condition is not true anymore.
I tried to use the condition system word of "matches", which works with regex, like
if $domain matches ^((?!mydomain\\.com).)*\$
But it fails with:
failed to expand ^((?!mydomain\\.com).)*\$ in filter file: $ not followed by letter, digit, or {
So, I am wondering - I think of working with "contains" and a negate of the domain name, something like:
if $domain contains !"mydomain.com"
or
if $domain contains !mydomain.com
I tried both, and both are valid and allow the delivery, but they are not performing the requested action, as if the condition was not met.
Any idea how to make it happen?
Please sign in to leave a comment.
Comments
0 comments