Skip to main content


ec_inc_counter — increment a Sieve counter


ec_inc_counter { counter }


ec_inc_counter allows you to increment an arbitrary Sieve counter. The convention for naming counters is a short category name, followed by a colon, followed by a more descriptive name for the counter. The counter values can be obtained on the console using the sieve:sieve1 stats command.

Most of the built-in Sieve actions will either implicitly increment a counter, or allow you to specify your own for that action; ec_inc_counter allows to you count the number of times that a particular part of your script is run, and can be useful for later statistical analysis.

if envelope :domain :is "from" "" {
  ec_inc_counter "stats:mail from the good guys";

See also ec_gauge_cache for a more general-purpose counter mechanism supporting increment, decrement and get operations in Sieve.

Was this page helpful?