[Dovecot] sieve and pattern matching

Stephan Bosch stephan at rename-it.nl
Sun Sep 11 18:06:48 EEST 2011


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.



More information about the dovecot mailing list