Hello list,
have a problem with sieve script. I want to perform an action if an arbitrary headerline contains a defined string. I tried with regex:
if header :regex [".*"] ["searchstri.*"] { fileinto "junk"; }
This is not working because regex is only used in 2nd argument ["searchstri.*"] In 1st argument [".*"] no regex is used, sieve expects just plain string. Something like this would work, if "x-myheader" contains "searchstring": if header :regex ["x-myheader"] ["searchstri.*"]....
How to solve this case and find a string in arbitrary/unknown headerline?
Thanks, Hajo
Op 6-9-2016 om 15:25 schreef Hajo Locke:
Hello list,
have a problem with sieve script. I want to perform an action if an arbitrary headerline contains a defined string. I tried with regex:
if header :regex [".*"] ["searchstri.*"] { fileinto "junk"; }
This is not working because regex is only used in 2nd argument ["searchstri.*"] In 1st argument [".*"] no regex is used, sieve expects just plain string. Something like this would work, if "x-myheader" contains "searchstring": if header :regex ["x-myheader"] ["searchstri.*"]....
How to solve this case and find a string in arbitrary/unknown headerline?
I don't think the Sieve language supports a test like that at this time.
Regards,
Stephan.
On 08-09-16 20:51, @lbutlr wrote:
On Tue Sep 06 2016 07:25:38 Hajo Locke <hajo.locke@gmx.de> said
How to solve this case and find a string in arbitrary/unknown headerline?
You’ll have to create multiple sieves covering the possible headers.
Maybe when you tell what you're trying to achieve, we can give you better advice.
Almost no one is looking for random strings in random headers, since headers are (somewhat) structured data. Could you share with us what string you are looking and why you don't know up front which header field you need to use to look for it?
Kind regards, Tom
Hello,
thanks for your help.
Am 08.09.2016 um 22:13 schrieb Tom Hendrikx:
On 08-09-16 20:51, @lbutlr wrote:
On Tue Sep 06 2016 07:25:38 Hajo Locke <hajo.locke@gmx.de> said
How to solve this case and find a string in arbitrary/unknown headerline? You’ll have to create multiple sieves covering the possible headers.
Maybe when you tell what you're trying to achieve, we can give you better advice.
Almost no one is looking for random strings in random headers, since headers are (somewhat) structured data. Could you share with us what string you are looking and why you don't know up front which header field you need to use to look for it?
We have a webmailer where experienced users are able to create filterrules. They can can choose from a lot of predefined headerlines and insert text to find. After that they choose a respective action. To cover all cases we had a choosable option "complete header" to find a string in every headerline without knowing the specific line. This is done easily in procmail:
:0 H
- ^*searchstring
i agree that an option like this is needless and it was a mistake to offer it. If this is not achievable in sieve, we have to remove this search-option. May be we replace by a kind of custom-headerline.
Kind regards, Tom
Thanks, Hajo
On 09-09-16 08:35, Hajo Locke wrote:
Hello,
thanks for your help.
Am 08.09.2016 um 22:13 schrieb Tom Hendrikx:
On 08-09-16 20:51, @lbutlr wrote:
On Tue Sep 06 2016 07:25:38 Hajo Locke <hajo.locke@gmx.de> said
How to solve this case and find a string in arbitrary/unknown headerline? You’ll have to create multiple sieves covering the possible headers.
Maybe when you tell what you're trying to achieve, we can give you better advice.
Almost no one is looking for random strings in random headers, since headers are (somewhat) structured data. Could you share with us what string you are looking and why you don't know up front which header field you need to use to look for it?
We have a webmailer where experienced users are able to create filterrules. They can can choose from a lot of predefined headerlines and insert text to find. After that they choose a respective action. To cover all cases we had a choosable option "complete header" to find a string in every headerline without knowing the specific line. This is done easily in procmail:
:0 H
- ^*searchstring
i agree that an option like this is needless and it was a mistake to offer it. If this is not achievable in sieve, we have to remove this search-option. May be we replace by a kind of custom-headerline.
I guess that would be my solution too.
Maybe you can check the existing configurations from your users to see how many ppl actually use this action. If there any only a few, then that might be used an an extra argument in the discussion on removing the option altogether. Especially when you are able to manually replace the existing uses with a construct that sieve *does* support (f.i. someone uses this because wasn't able to determine which header name was actually needed, which is easier when you actually filtered a few messages).
Kind regards, Tom
participants (4)
-
@lbutlr
-
Hajo Locke
-
Stephan Bosch
-
Tom Hendrikx