Dovecot 1.2.17 What is the sieve syntax for matching text somewhere in a subject line, but not at the beginning of the line? Background: Multiple machines each send a message with the subject of "<hostname> operations run" to a mail server. The <hostname> value is different for each sender. This sieve filter does not match any message: require ["fileinto","envelope","reject","vacation","imapflags","relational","co mparator-i;ascii-numeric","regex","notify"]; require ["body", "fileinto", "regex"]; # currentops reports if header :contains "Subject" ".* operations run" { fileinto "currentops"; stop; } However, a similar filter will match if, and only if, the string occurs at the beginning of the subject line. The various sieve help pages I've found suggest that pattern matching anywhere in the subject line should work, not just at the beginning. How to achieve this? TIA dn
On 9/10/2011 9:49 PM, David Newman wrote:> Dovecot 1.2.17 > > What is the sieve syntax for matching text somewhere in a subject line, > but not at the beginning of the line? > > Background: Multiple machines each send a message with the subject of > "<hostname> operations run" to a mail server. The<hostname> value is > different for each sender.If I understand your question correctly, the following is the easiest answer: if header :matches "subject" "* operations run" { }> This sieve filter does not match any message: > > require > ["fileinto","envelope","reject","vacation","imapflags","relational","co > mparator-i;ascii-numeric","regex","notify"]; > require ["body", "fileinto", "regex"]; > > # currentops reports > if header :contains "Subject" ".* operations run" > { > fileinto "currentops"; > stop; > }Right, because that is not how :contains works. Check http://tools.ietf.org/html/rfc5228#section-2.7.1 for more info. Regards, Stephan.