GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Sieve Language   Up: Extensions   FastForward: Reporting Bugs   Contents: Table of ContentsIndex: Function Index

5.8.2 The relational extension

The ‘relational’ extension complies with RFC 3431. It is a built-in extension. When enabled, the two new match types become available: :count and :value. Both keywords take a single argument defining the relational operator to use:

"gt"greater than (‘>’)
"ge"greater than or equal (‘>=’)
"lt"less than (‘<’)
"le"less than or equal (‘<=’)
"eq"equal to (‘==’)
"ne"not equal to (‘!=’)

The :value keyword requires a relational comparison between strings. The left side of the relation is formed by the value from the message. The right side of the relation is the value from the test expression. If there are multiple values on either side or both sides, the test is considered true if any pair is true. For example,

require ["relational", "fileinto"];

if header :value "gt" :comparator "i;ascii-numeric"
                ["x-spam-level] ["5"]
{
  fileinto "spam";
}  

The :count keyword counts the specified entities in the message and compares their number with the value given in the test expression. The latter must be a list of one element. This match type can only be used with numeric comparators. For example, the following script will discard any message with 10 or more recipient addresses in the ‘To’ and ‘Cc’ headers:

require "relational";

if address :count "ge" :comparator "i;ascii-numeric"
                      ["to", "cc"] ["10"]
{
    discard;
}

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Sieve Language   Up: Extensions   FastForward: Reporting Bugs   Contents: Table of ContentsIndex: Function Index