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 Tue Sep 06 2016 07:25:38 Hajo Locke <hajo.locke at 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.
On 08-09-16 20:51, @lbutlr wrote:> On Tue Sep 06 2016 07:25:38 Hajo Locke <hajo.locke at 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://dovecot.org/pipermail/dovecot/attachments/20160908/5cf9332c/attachment-0001.sig>