Sieve environment extension

From Messaging Server Technical Reference Wiki
Jump to: navigation, search


New in Messaging Server 7.0-3.01, the Sieve environment extension specified in RFC 5183 (Sieve Email Filtering: Environment Extension) has been implemented. All of the items defined in the RFC are provided, namely: domain, host, location, name, phase, remote-host, remote-ip, version. Additionally, the vnd.sun.source-channel item returns the name of the current source channel and the vnd.sun.destination-channel item returns the name of the current destination channel.

New in Messaging Server 7.3-0.01, the vnd.sun.autoreply-internal item returns TRUE or FALSE according to whether the autoreply criteria have been met for use of the "internal" autoreply response text. Also new in Messaging Server 7.3-0.01, the MTA supports two new Sieve environment items, vnd.sun.authenticated-sender-address and vnd.sun.authenticated-sender-id. The former provides access to the sender address that's associated with the authentication state for the SMTP session. The latter provides similar access to the user identity.

New in 7.0.5, the MTA supports the new Sieve environment item vnd.oracle.last-verdict. When the Sieves associated with a recipient are evaluated in order, each evaluation that performs an explicit handling action sets this item as it finishes so the next Sieve in the sequence can check it. A Sieve script that doesn't perform an explicit handling action will leave this item unchanged. Possible values that can be set are:

  • refuse
  • reject
  • ereject
  • jettison
  • fileinto
  • redirect
  • keep
  • discard

Note that testing the vnd.oracle.last-verdict environment item makes the Sieve script recipient-specific in the same fashion an envelope "To" test does, and will result in this and subsequent Sieves being reevaluated for every recipient. Although any script can test this item, it is intended for use when other applications and utilities such as imexpire ask the MTA to perform antispam and antivirus checks.

New in 8.0, the MTA supports a new Sieve environment item, vnd.oracle.mt-priority. This item returns the current MT-PRIORITY value as a string.

New in 8.0, the MTA supports a new Sieve environment item, vnd.oracle.operation-type. This item returns the current type of enqueue operation that is underway. The possible values are "DEFAULT", "SUBMIT", "RELAY", and "PASSTHROUGH".

New in 8.0.1.2, the MTA supports new Sieve environment items, vnd.oracle.notifycount, vnd.oracle.notifyquota, vnd.oracle.vacationcount, vnd.oracle.vacationquota The "count" items return the number of notification or vacation messages the current sieve has enqueued. The "quota" items return the number of additional notification or vacation actions the current sieve is allowed to perform.

Two additional private Sieve environment items have been added in MS 8.0.2.2. vnd.oracle.mime_levels returns the number of accessible MIME levels in the current message, i.e. the MIME "depth" of the message. vnd.oracle.max_mime_widh returns the maximum number of MIME parts found in any multipart in the message. Arbitrary, custom environment items may be set via the FROM_ACCESS mapping table or any of the recipient *_ACCESS mapping tables using the $+E flag. The value of such a custom environment item may subsequently be tested in a Sieve script. For instance, the following FROM_ACCESS entry defines, for messages coming in via the SMTP port from the tcp_local channel (the Internet), the custom environment item "heloname", giving it the value "yes" of the name the SMTP client claimed on the HELO/EHLO line:


FROM_ACCESS

   TCP|*|25|*|SMTP/*/*|MAIL|tcp_local|*       $C$+Eheloname|$2

A Sieve script may then test this custom "heloname" environment item:


require ["environment","fileinto"];
# First, check if heloname item is set:
if environment :contains "heloname" "" {
# If heloname item IS set, then check its value:
  if environment "heloname" :is "Bogus Name" {fileinto "bogus"; }
}

See also: