Count Number of To Addresses (Addressees) in Sieve

Count Number of To Addresses (Addressees) in Sieve

Sieve is a mail filter language.

From my understanding of https://tools.ietf.org/html/rfc5231#section-4.2

require ["fileinto", "relational", "comparator-i;ascii-numeric"];

if 
  allof(
   address :matches "From" "test@example.com",
   address :count "ge" :comparator "i;ascii-numeric" ["to", "cc"] ["5"]
 )
{
  fileinto "\\Trash";
}

This filter will move the message to trash if it has >=5 addressees and comes from test@example.com

Leave a Reply

Your email address will not be published. Required fields are marked *