GNU Mailutils |
|
General-Purpose Mail Package |
Official GNU Software |
The only control flow statement Sieve has is if
statement. In its
simplest form it is:
if condition
{ … }
The effect of this statement is that the sequence of actions between the
curly braces is executed only if the condition
evaluates to
true
.
A more elaborate form of this statement allows to execute two different sets of actions depending on whether the condition is true or not:
if condition
{ … } else { … }
The most advanced form of the “if” statement allows to select an action depending on what condition from the set of conditions is met.
ifcond1
{ … } elsifcond2
{ … } else { … }
There may be any number of “elsif” branches in an “if” statement. However it may have at most one “else” branch. Notes for C programmers:
Here’s an example of “if” statement:
if header :contains "from" "coyote" { discard; } elsif header :contains ["subject"] ["$$$"] { discard; } else { fileinto "INBOX"; }
The following section describes in detail conditions used in “if” statements.
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.