Sieve Email Filtering: Delivering to Special-Use Mailboxes
Extracted elements (16)
The extension restricts special-use mailbox lookup to the user's personal namespace to avoid searching the entire mail storage (preventing undue system load) and to prevent security issues where messages could be unexpectedly or maliciously filed into shared mailboxes with special-use attributes.
The ':specialuse' fallback does not attempt delivery to the default mailbox when the special-use mailbox delivery fails for non-existence reasons. This prevents messages from being unexpectedly spread across two mailboxes in case of transient or intermittent delivery failures.
This extension was created because the existing workaround using 'mboxmetadata' and IMAP METADATA was deemed too complex for implementers who only need access to special-use attributes in Sieve, not the full METADATA capability.
The ':specialuse' argument's string parameter is not a constant string; variable substitutions are allowed when the 'variables' extension (RFC 5229) is active, in which case the special-use attribute syntax is only verified at runtime.
The 'specialuse_exists' test's delivery check is defined by reference to the 'mailboxexists' test in RFC 5490 Section 3.1, which specifies when delivery into a mailbox is deemed possible.
If delivery to the special-use mailbox fails for reasons unrelated to its existence, the Sieve interpreter MUST NOT attempt delivery to the default mailbox as a fallback; it MUST proceed as if ':specialuse' were absent and delivery to the named mailbox had failed.
If more than one personal mailbox has the specified special-use attribute and one of them is the default mailbox named by the positional argument, that mailbox MUST be used for delivery.
If neither the special-use mailbox nor the default mailbox exists, the 'fileinto' action MUST proceed exactly as it does when the ':specialuse' argument is absent and the named mailbox does not exist.
If the server supports the CREATE-SPECIAL-USE IMAP capability, it SHOULD assign the special-use attribute specified with ':specialuse' to any newly created mailbox that results from implicit creation by 'fileinto'.
Implementations SHOULD handle an invalid special-use attribute in the same way as an invalid mailbox name is handled.
When multiple mailboxes share the relevant special-use attribute and none is the default, implementations SHOULD ensure that the mailbox choice is made consistently so that the same mailbox is used every time while assignments remain unchanged.
The capability string 'special-use' is advertised by Sieve implementations that support the 'specialuse_exists' test and the ':specialuse' argument for 'fileinto'.
The ':specialuse' argument extends the 'fileinto' command to deliver messages to a mailbox identified by a special-use attribute rather than by name. If no matching special-use mailbox exists or the attribute is unknown, 'fileinto' falls back to the positional mailbox name argument.
The 'specialuse_exists' test checks whether a special-use attribute is assigned to a particular mailbox or any mailbox in the user's personal namespace that allows message delivery. Without a mailbox argument, it tests any personal namespace mailbox; with a mailbox argument, it tests that specific mailbox for the listed attributes.
IANA has registered the 'special-use' capability name in the 'Sieve Extensions' registry, describing it as adding the 'specialuse_exists' test and ':specialuse' argument for 'fileinto', with contact at the Sieve discussion list.
Restricting special-use mailbox lookup to the user's personal namespace prevents malicious or accidental filing of messages into shared mailboxes that have special-use attributes assigned. This restriction may be lifted for future special-use attributes only after careful security review.