Sieve filter manipulation of conversion tags

The MTA has a private mechanism of conversion tags, which may  be set and used in a variety of ways and for a variety of purposes  including special routing, or user-specific automatic document  conversion. The MTA&#x27;s Sieve implementation includes private Sieve extensions to inspect and set these conversion tags. These private Sieve extensions include an  envelope test field    (new in MS 6.3, and supported only in system  Sieves) which takes an optional   modifier, as well  as several actions supported only in  system Sieve filters: the (new in  MS 6.3)   and    actions, and the (new in Messaging Server 7.0u3)    action.

The actions,   , and    actions take as argument either a Sieve string (containing a single  conversion tag value) or Sieve list (consisting of a list of strings  each of which is a single conversion tag value). clears whatever existing conversion tags might be present, and then adds the specified conversion tag(s). Note that these conversion tag actions are performed relatively late in  message processing, so in particular   can  be used to undo all other conversion tag setting mechanisms (including  LDAP attribute caused conversion tags).

Note that  operates only on conversion  tags set via a   or    action. However, it is possible by combining operations to have   remove a  conversion tag present due to some other reason (such as due to a user  LDAP attribute having previously set a conversion tag): obtain the  current set of conversion tags via the envelope field    and put it into a  Sieve variable, then do a    to the value of that variable, then do a. The reason why this is required (and why   operates the way it does) is to  avoid triggering per-recipient message copy split-up: obtaining  potentially recipient-specific envelope fields, such as envelope  conversion tags, forces per-recipient sensitivity and evaluation of  Sieve scripts, and hence potentially forces per-recipient message copy  split-up.

For instance, in a channel Sieve filter, if one wanted to remove an  "unprocessed" conversion tag (if present) and replace it with  a "processed" conversion tag, while preserving any other  existing conversion tags, one could use: require &#x5b;"envelope","variables"&#x5d;; if envelope :matches "conversiontag" "&#x2a;" { setconversiontag ${1}; removeconversiontag "unprocessed"; addconversiontag "processed"; } Another use of the " " test of the " " field is to count how many  active conversion tags are present. For instance, if a "high" number of (distinct) conversion tags might as well be considered a  request for "full" (do everything) processing, and if there  is also a single conversion tag " " that has  that meaning (requesting full processing), then consider: require &#x5b;"envelope","relational"&#x5d;; if envelope :count "ge" "conversiontag" "3" { setconversiontag "full-processing"; }

See also:
 * Conversion tags
 * Sieve conversiontag extensions
 * Sieve envelope extension
 * Sieve variables extension
 * Sieve hierarchy
 * destinationfilter Option
 * Sieve filters