Sieve mime extension

As of Messaging Server 7.0u1, the MTA supports the Sieve  extension of RFC 5703 (Sieve Email Filtering: MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure);  the capability name is " ". (The MTA does not, however, support either " " or " ", also described in RFC 5703; for replacement sorts of effects, see instead the MTA&#x27;s charset conversion facility  or the conversion channel, and for enclosure sorts of effects, see instead the MTA&#x27;s message capture facilities.)

New in the 8.0 release is support for the " " Sieve extension (from RFC 5703); the capabability name is " ". In addition to the " " control command, the MTA&#x27;s implementation also supports the nonstandard " " control command: continue &#x5b;:name string&#x5d; " " has the expected semantics: control is passed to the bottom of the " " loop.

Note that the MTA also supports a nonstandard " " extension, discussed under Sieve loop extension. It is wise to stick with use of " " when it suffices for a purpose, but the " " construct does offer another alternative for more complex loop-based processing.

New in the 8.0 release is support for the " " Sieve extension (from RFC 5703). Note that since the MTA&#x27;s Sieve support is implemented as an overlay on top of an underlying language interpreter,  the use of " " outside of a  " "       is not detected as an error at compile time. Additionally, " "       is only supported on leaf parts: it cannot be used on multipart and       message/rfc822 parts.

New in MS 8.1 is the ability to control whether or not the foreverypart Sieve control looks inside of nested messages or treats them as leaf parts. The  argument tells foreverypart to look inside and is the default. causes nested messages to be treated as leaf parts.  As of the 8.0 release, the behavior of the Sieve " " test inside of " " loops has been changed. Previously " " operated on the message as a whole no matter what the context; now it operates on the current part only. Note that only decoded part data is considered; part headers are not included in the size calculation. Also note that the size of non-leaf (message and multipart) parts is currently zero; this may or may not be changed in the future.

This nonstandard extension to the Sieve " " test is mainly intended to be used to implement attachment size checks. However, since the " " test can also be used as function call (in which case it returns the size in octets), this can also be used in conjunction with  " " to build message manifests for insertion into header fields or logging with the  " " action.

For instance, one use of " " would be to scan the parts of a message to build a so-called "manifest" of the message, where the    extension could be used to add the manifest to the first text part of the message: require &#x5b;"variables","mime","foreverypart"&#x5d;; addprefix "Manifest:"; foreverypart { if not anyof (header :mime :type :is "Content-type" "multipart",                header :mime :type :is "Content-type" "message") {     if header :mime :contenttype :matches "Content-type" "&#x2a;" { addprefix "Part " + "${0}" + ", Size " + size + " characters of content"; }  } } addprefix "Total size: " + size + " characters including header"; addprefix "End of manifest.\r\n\r\n"; In a system-level Sieve (so that  may be used), the following Sieve script will add a conversion tag incorporating the message&#x27;s content size as part of the conversion tag: require &#x5b;"variables","foreverypart"&#x5d;; counter = 0; foreverypart { counter = counter + size; }; addconversiontag "size". counter; As of the 8.0 release, when user Sieves are allowed to use integer variables (system-level Sieves had already been allowed to do so), the following Sieve would work even at user-level to add a manifest to the first text part of the message: require &#x5b;"variables","mime","foreverypart"&#x5d;; partnumber=0; total=0; addprefix "Manifest:"; foreverypart { if not anyof (header :mime :type :is "Content-type" "multipart",                header :mime :type :is "Content-type" "message") {     partnumber += 1; total = total + size; if header :mime :contenttype :matches "Content-type" "&#x2a;" { addprefix "Part # ". partnumber. " of type ". "${0}" .                " and size ". size. " characters"; }    }   }; addprefix "Total size: ". size. " characters including header, with"; addprefix "           ". total. " characters of content."; addprefix "End of manifest.\r\n\r\n";

See also:
 * Brief overview of Sieve language elements
 * Sieve addprefix and addsuffix extensions
 * Sieve loop extension
 * Sieve supported extensions
 * Sieve filters