Pigeonhole Sieve Interpreter¶
The Pigeonhole project provides Sieve support as a plugin for Dovecot’s Local Delivery Agent (LDA) and also for its LMTP service. The plugin implements a Sieve interpreter, which filters incoming messages using a script specified in the Sieve language (RFC 5228). The Sieve script is provided by the user and, using that Sieve script, the user can customize how incoming messages are handled. Messages can be delivered to specific folders, forwarded, rejected, discarded, etc.
Configuration and Use¶
Supported Features¶
Sieve language has various extensions. You can find more information about the extensions from the Sieve Mail Filtering Language Charter or the Sieve.info wiki page.
Note
Sieve doesn’t support running external programs.
The Pigeonhole Sieve interpreter recognizes the following Sieve extensions:
Extension |
Support Status |
Default Enabled |
Purpose |
body RFC 5173 |
supported |
yes |
Allows evaluating the body of a message |
copy RFC 3894 |
supported |
yes |
Allows storing and forwarding messages without canceling the implicit keep |
date RFC 5260#section-4 |
supported (v0.1.12+) |
yes |
Adds the ability to test date and time values in various ways |
duplicate RFC 7352 |
supported (v0.4.3+) |
yes |
Allows detecting duplicate message deliveries |
editheader RFC 5293 |
supported (v0.3.0+) |
no |
Adds the ability to add and remove message header fields |
encoded-character RFC 5228#section-2.4.2.4 |
supported |
yes |
Allows encoding special characters numerically |
enotify RFC 5435 |
supported (v0.1.3+) |
yes |
Provides the ability to send notifications by various means (currently only mailto) |
envelope RFC 5228#section-5.4 |
supported |
yes |
Allows evaluating envelope parts, i.e. sender and recipient |
environment RFC 5183 |
supported (v0.4.0+) |
yes |
Allows testing against various labeled values from the execution environment |
fileinto RFC 5228#section-4.1 |
supported |
yes |
Allows storing messages in folders other than INBOX |
foreverypart RFC 5703#section-3 |
supported (v0.4.14+) |
yes |
Allows iterating through the message’s MIME parts |
ihave RFC 5463 |
supported (v0.2.4+) |
yes |
Adds the ability to test for support of Sieve extensions and dynamically invoke their use |
imap4flags RFC 5232 |
supported |
yes |
Allows adding IMAP flags to stored messages |
imapsieve RFC 6785 |
supported (v0.4.14+) |
no (plugin) |
Provides access to special environment items when executing at IMAP events |
include RFC 6609 |
supported (v0.4.0+) |
yes |
Allows including other Sieve scripts |
index RFC 5260#section-6 |
supported (v0.4.7+) |
yes |
Allows matching specific header field instances by index |
mailbox RFC 5490#section-3 |
supported (v0.1.10+) |
yes |
Provides a mailbox existence check and allows creating mailboxes upon fileinto |
mboxmetadata RFC 5490 |
supported (v0.4.7+) |
no |
Provides access to mailbox METADATA entries |
mime RFC 5703#section-4 |
supported (v0.4.14+) |
yes |
Allows testing parts of structured MIME header fields |
extracttext RFC 5703#section-7 |
supported (v0.4.14+) |
yes |
Allows extracting text from individual message MIME parts |
regex https://tools.ietf.org/html/draft-murchison-sieve-regex-08 |
supported |
yes |
Provides regular expression match support |
reject RFC 5429#section-2.2 |
supported |
yes |
Allows rejecting messages with a rejection bounce message |
relational RFC 5231 |
supported |
yes |
Provides relational match support |
servermetadata RFC 5490 |
supported (v0.4.7+) |
no |
Provides access to server METADATA entries |
spamtest RFC 5235 |
supported (v0.1.16+) |
no |
Implements a uniform way to test against headers added by spam filters |
subaddress RFC 5233 |
supported |
yes |
Allows testing against delimited elements of the local part of addresses |
vacation RFC 5230 |
supported |
yes |
Provides auto-responder functionality, e.g. for when the user is on vacation |
vacation-seconds RFC 6131 |
supported (0.2.3+) |
no |
Extends vacation extension with the ability to send vacation responses with intervals of seconds rather than days |
variables RFC 5229 |
supported |
yes |
Adds variables support to the language |
virustest RFC 5235 |
supported (v0.1.16+) |
no |
Implements a uniform way to test against headers added by virus scanners |
imapflags(obsolete draft) |
deprecated |
no |
Old version of imap4flags (for backwards compatibility with CMU Sieve) |
notify https://tools.ietf.org/html/draft-martin-sieve-notify-01 |
deprecated |
no |
Old version of enotify (for backwards compatibility with CMU Sieve) |
The following Dovecot-specific Sieve extensions are available for the Pigeonhole Sieve interpreter:
Extension |
Support Status |
Default Enabled |
Purpose |
supported (v0.3.0+) |
no |
Allows logging debug messages |
|
supported (v0.4.14+) |
no |
Extends the standard “environment” extension with extra items and a variables namespace for direct access |
|
Extprograms Plugin (v0.3+) |
no |
Implements executing a pre-defined set of external programs with the option to process string data through the external program |
|
Extprograms plugin (v0.3+) |
no |
Implements filtering messages through a pre-defined set of external programs |
|
Extprograms plugin (v0.3+) |
no |
Implements piping messages to a pre-defined set of external programs |
|
supported (v0.4.14+) |
no |
Implements sending Messaging Abuse Reporting Format (MARF) reports (RFC 5965) |
Note
Not all extensions are enabled by default, as shown in the table above.
Deprecated extensions, extensions that add the ability to change messages,
extensions that require explicit configuration and extensions that are still
under development are not enabled without explicit configuration. This means that
the sieve_extensions
or
sieve_global_extensions
settings need to be
adjusted accordingly. Also, for plugins it is not enough to add
the plugin name to the sieve_plugins
setting;
the extensions introduced by the plugin also need to be enabled explicitly.
ManageSieve server¶
To give users the ability to upload their own Sieve scripts to your server, i.e. without the need for shell or FTP access, you can use the ManageSieve protocol. This is also provided by the Pigeonhole project. It is available as a separate Dovecot service. Its configuration and use is explained on the Pigeonhole ManageSieve page.