Mailing List Archive

Filter for Conditional Header Removal
Hi,

We have following requirement any mail coming from abc@abc.com and subject
contains "SomeThing" to go to xyz@mydomain.com With complete headers and to
abc@mydomain.com without Cc and From headers.


I tried following filter but it's removing headers for both xyz@mydomain.com
& abc@mydomain.com.

=====

if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
"SomeThing")
then
deliver "xyz@mydomain.com" (should go to xyz@mydomain.com With complete
headers )
endif

if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
"SomeThing")
then
headers remove Cc
headers remove From
deliver "abc@mydomain.com" (should go to abc@mydomain.com Without Cc and
From headers )
endif
=====

Regards,

Ajay
--
## 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/
Re: Filter for Conditional Header Removal [ In reply to ]
On 12/04/18 10:05, Ajay Kajla via Exim-users wrote:
> if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
> "SomeThing")
> then
> headers remove Cc

Check the docs on that last command.

--
Jeremy

--
## 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/
Re: Filter for Conditional Header Removal [ In reply to ]
Hi Jeremy,

> if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
> "SomeThing")
> then
> headers remove Cc

>> Check the docs on that last command.

I'm sorry, but can you please be little more expressive on this.

With Best Regards,
Ajay

On Thu, Apr 12, 2018 at 2:58 PM, Jeremy Harris via Exim-users <
exim-users@exim.org> wrote:

> On 12/04/18 10:05, Ajay Kajla via Exim-users wrote:
> > if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
> > "SomeThing")
> > then
> > headers remove Cc
>
> Check the docs on that last command.
>
> --
> Jeremy
>
> --
> ## 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/
>



--
--
## 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/
Re: Filter for Conditional Header Removal [ In reply to ]
On 12/04/18 11:35, Ajay Kajla via Exim-users wrote:
>> On 12/04/18 10:05, Ajay Kajla via Exim-users wrote:
>>> if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
>>> "SomeThing")
>>> then
>>> headers remove Cc
>>
>> Check the docs on that last command.

http://exim.org/exim-html-current/doc/html/spec_html/filter_ch-exim_filter_files.html#SECTheaders

--
## 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/
Re: Filter for Conditional Header Removal [ In reply to ]
On 12 April 2018 at 10:05, Ajay Kajla via Exim-users <exim-users@exim.org>
wrote:

> Hi,
>
> We have following requirement any mail coming from abc@abc.com and subject
> contains "SomeThing" to go to xyz@mydomain.com With complete headers and
> to
> abc@mydomain.com without Cc and From headers.
>
> I tried following filter but it's removing headers for both
> xyz@mydomain.com
> & abc@mydomain.com.
>
> =====
>
> if ("$h_from:" contains "abc@abc.com" and "$header_subject:" contains
> "SomeThing")
> then
> deliver "xyz@mydomain.com" (should go to xyz@mydomain.com With complete
> headers )
> endif


I can't help with the why headers are being removed for both. However my
thought is that you might want to be a bit careful with

"$h_from:" contains "abc@abc.com"


as I'm pretty sure it will also match when $h_from is, say, "zabc@abc.com"
(because this also *contains* "abc@abc.com").

Mind, I might well be wrong as I've only used a system filter in one
situation, and that was about 10 years ago! :-)

Cheers,
Mike B-)

--
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
--
## 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/