Sieve custom tests via mappings

As of updates to MS 6.2 and updates to MS 6.3, the MTA&#x27;s Sieve implementation supports custom Sieve tests defined via  MTA mapping tables. (This functionality also existed in an alternate, much less esthetic form, in earlier versions.)

Any mapping table with a name of the form     is  presumed to define a new, custom Sieve test  . The string result of the mapping will be returned in the  " "  Sieve variable;  the flag result of the  mapping will be returned in the Sieve " "  variable.

For instance, a mapping table FILTER_fruitcolor apple      red-or-yellow-or-green-or-pink$Y apricot    orange$Y avocado    green$Y banana     yellow$Y blackberry purple$Y blueberry  blue-or-purple$Y grape      green-or-red-or-purple$Y kiwi       green$Y lemon      yellow$Y lime       green$Y mango      orange$Y orange     orange$Y peach      yellow-or-white$Y pineapple  yellow$Y raspberry  pink-or-yellow$Y strawberry red-or-pink$Y watermelon red-or-pink-or-yellow$Y &#x2a;          $N would allow use of a " " test in Sieve; e.g., require &#x5b;"variables","fileinto"&#x5d;; if header :matches "Fruit-of-the-day" "&#x2a;" {set "todaysfruit" "${0}";} if fruitcolor "${todaysfruit}" { set "color" "${0}"; set "flags" "${1}"; if "${flags}" :is "N" {fileinto "unknown-color-fruits";} else { if "${color}" :contains "red" {fileinto "red-fruits";} if "${color}" :contains "yellow" {fileinto "yellow-fruits";} if "${color}" :contains "green" {fileinto "green-fruits";} } }

See also:
 * Mapping tables
 * Sieve variables extension
 * Sieve supported extensions
 * Sieve language