Re: [exim] BCC Filter not working

Góra strony
Delete this message
Reply to this message
Autor: Jan Ingvoldstad
Data:  
Dla: exim-users@exim.org
Temat: Re: [exim] BCC Filter not working
On Mon, Apr 24, 2017 at 6:53 AM, Ajay Kajla via Exim-users <
exim-users@???> wrote:

> Hi,
>
> I'm trying to setup following exim filter but it's not working, assuming
> example.com is my domain and I want any outgoing mail from my server
> containing some key-work in BCC should also get delivered to our monitoring
> ID alerts@???.
>
> #####Test Filter 20/Apr/2017
> if ("$h_from:" contains "example.com" and $h_bcc:" contains "ajaykajla")
> then
> unseen deliver "alerts@???"
> endif
> ######
>
> Is there any problem in above filter?



The Bcc header is only there at the time when the message is sent by the
e-mail client, the client doesn't actually* provide this header to the
server.

You need to check the recipient list instead.

${if forany{<, $recipients}{match{$item}{^ajaykajla@}}{yes}{no}}


This would match any recipient address that starts with ajaykajla@, and you
can then choose what to do about that.

See the entry for forany in
http://www.exim.org/exim-html-current/doc/html/spec_html/ch-string_expansions.html
for where I snarfed this specific example.

* Technically, it *could* be added, but then it would usually be stripped
by the MTA. So it's easiest just to think that it's not available.
--
Jan