SIEVE-FILTER(1)
π SIEVE-FILTER(1) π
okay bestie, gather round, because this is Pigeonhole's Sieve mailbox filter tool and she is gorgeous but also a little bit feral π¦
β οΈ This tool is still experimental. Read this manual carefully, and backup any important mail before using this tool. Also note that some of the features documented here are not actually implemented yet; this is clearly indicated where applicable.
β¨ SYNOPSIS β¨
sieve-filter [options] script-file source-mailbox [discard-action]
πΈ DESCRIPTION πΈ
The sieve-filter command is part of Pigeonhole (pigeonhole(7)), which adds Sieve (RFC 5228) and ManageSieve (RFC 5804) support to Dovecot (dovecot(1)). slay.
So here's the lore: the Sieve language was originally meant for filtering messages upon delivery. But sometimes you wanna filter messages that are already chillin' in a mailbox β like, say, a bug in a Sieve script caused a whole pile of messages to get delivered wrong. tragic. π Using the sieve-filter tool you can apply a Sieve script to all the messages in a particular source-mailbox, which means you can delete messages, store them in a different mailbox, change their content, and change the assigned IMAP flags and keywords. it's giving full control π
Attempts to send messages to the outside world are ignored by default for obvious reasons, but β using the proper command line options β it is possible to capture and handle outgoing mail as well. no cap.
If no options are specified, the sieve-filter command runs in simulation mode, where it only prints what would be performed, without actually doing anything. Use the -e option to activate true script execution. Also, the source-mailbox is opened read-only by default, meaning that it normally always remains unchanged. Use the -W option to allow changes in the source-mailbox.
Even with the -W option enabled, messages in the source-mailbox are only potentially modified or moved to a different folder. Messages are never lost unless a discard-action argument other than keep (the default) is specified. If the Sieve filter decides to store the message in the source-mailbox β where it obviously already exists β it is never duplicated there. In that case, the IMAP flags of the original message can be modified by the Sieve interpreter using the imap4flags extension, provided that -W is specified. If the message itself is modified by the Sieve interpreter (e.g. using the editheader extension), a new message is stored and the old one is expunged. However, if -W is omitted, the original message is left untouched and the modifications are discarded. π
π¨ CAUTION π¨
Although this is a very useful tool, it can also be very destructive when used improperly. A small bug in your Sieve script in combination with the wrong command line options could cause it to discard the wrong e-mails. And, even if the source-mailbox is opened in read-only mode to prevent such mishaps, it can still litter other mailboxes with spurious copies of your e-mails if your Sieve script decides to do so. Therefore, users are advised to read this manual carefully and to use the simulation mode first to check what the script will do. And, of course:
π₯ MAKING A BACKUP IS IMPERATIVE FOR ANY IMPORTANT MAIL! π₯
like, fr fr. do not skip this step. π
β¨ OPTIONS β¨
-cconfig-file β Alternative Dovecot configuration file path.-Cβ Force compilation. By default, the compiled binary is stored on disk. When this binary is found during the next execution ofsieve-filterand its modification time is more recent than the script file, it is used and the script is not compiled again. This option forces the script to be compiled, thus ignoring any present binary. Refer tosievec(1)for more information about Sieve compilation.-ddump-file β Causes a dump of the generated code to be written to the specified file. This is identical to the dump produced bysieve-dump(1). Using'-'as filename causes the dump to be written to stdout.-Dβ Enable Sieve debugging.-eβ Turns on execution mode. By default, thesieve-filtercommand runs in simulation mode in which it changes nothing, meaning that no mailbox is altered in any way and no actions are performed. It only prints what would be done. Using this option, thesieve-filtercommand becomes active and performs the requested actions. main character energy fr π-mdefault-mailbox β The mailbox where the (implicit)keepSieve action stores messages. This is equal to the source-mailbox by default. Specifying a different folder will have the effect of moving (or copying if-Wis omitted) all kept messages to the indicated folder, instead of just leaving them in the source-mailbox. Refer to the explanation of the source-mailbox argument for more information on mailbox naming.-osetting=value β Overrides the configuration setting from/etc/dovecot/dovecot.confand from the userdb with the given value. In order to override multiple settings, the-ooption may be specified multiple times.-qoutput-mailbox [not implemented yet] β Store outgoing e-mail into the indicated output-mailbox. By default, thesieve-filtercommand ignores Sieve actions such asredirect,reject,vacationandnotify, but using this option outgoing messages can be appended to the indicated mailbox. This option has no effect in simulation mode. Flags of redirected messages are not preserved.-Qmail-command [not implemented yet] β Send outgoing e-mail (e.g. as produced byredirect,rejectandvacation) through the specified program. By default, thesieve-filtercommand ignores Sieve actions such asredirect,reject,vacationandnotify, but using this option outgoing messages can be fed to the stdin of an external shell command. This option has no effect in simulation mode.
π¨ Unless you really know what you are doing, DO NOT USE THIS TO FEED MAIL TO SENDMAIL!.
-sscript-file [not implemented yet] β Specify additional scripts to be executed before the main script. Multiple-sarguments are allowed and the specified scripts are executed sequentially in the order specified at the command line.-uuser/mask β Run the command only for the given user. It's also possible to use'*'and'?'wildcards (e.g.-u *@example.org).-vβ Produce verbose output during filtering.-Wβ Enables write access to the source-mailbox. This allows (re)moving the messages from the source-mailbox, changing their contents, and changing the assigned IMAP flags and keywords.-xauth_info β auth_info specifies additional conditions for the user command. The auth_info option string has to be given asname=valuepair. For multiple conditions the-xoption could be supplied multiple times.
Possible names for the auth_info are:
serviceβ The service for which the userdb lookup should be tested. The value may be the name of a service, commonly used with Dovecot. For example:imap,pop3orsmtp.sessionβ Session identifier.lipβ The local IP address (server) for the test.ripβ The remote IP address (client) for the test.lportβ The local port, e.g.143rportβ The remote port, e.g.24567real_lipβ The local IP to which the client connected on this host.real_ripβ The remote IP where client connected from to this host.real_lportβ The local port to which client connected to to this host.real_rportβ The remote port from where the client connected from to this host.forward_<field>β Field to forward as%{forward:field}to auth process.
π¦ ARGUMENTS π¦
- script-file β Specifies the Sieve script to (compile and) execute.
Note that this tool looks for a pre-compiled binary file with a .svbin extension and with basename and path identical to the specified script. Use the -C option to disable this behavior by forcing the script to be compiled into a new binary.
- source-mailbox β Specifies the source mailbox containing the messages that the Sieve filter will act upon.
This is the name of a mailbox, as visible to IMAP clients, except in UTF-8 format. The hierarchy separator between a parent and child mailbox is commonly '/' or '.', but this depends on your selected mailbox storage format and namespace configuration. The mailbox names may also require a namespace prefix.
This mailbox is not modified unless the -W option is specified.
- discard-action β Specifies what is done with messages in the source-mailbox that where not kept or otherwise stored by the Sieve script; i.e. those messages that would normally be discarded if the Sieve script were executed at delivery. The discard-action parameter accepts one of the following values:
keep(default) : Keep discarded messages in source mailbox.movemailbox : Move discarded messages to the indicated mailbox. This is for instance useful to move messages to aTrashmailbox. Refer to the explanation of the source-mailbox argument for more information on mailbox naming.delete: Flag discarded messages as\DELETED.expunge: Expunge discarded messages, meaning that these are removed irreversibly when the tool finishes filtering. π
When the -W option is not specified, the source-mailbox is immutable and the specified discard-action has no effect. This means that messages are at most copied to a new location. In contrast, when the -W is specified, messages that are successfully stored somewhere else by the Sieve script are always expunged from the source-mailbox, with the effect that these are thus moved to the new location. This happens irrespective of the specified discard-action. Remember: only discarded messages are affected by the specified discard-action. iykyk π
β EXIT STATUS β
sieve-filter will exit with one of the following values:
0β Sieve filter applied successfully. (EX_OK,EXIT_SUCCESS) π64β Command line usage error.65β Data format error or operation is not possible.67β User does not exist.68β Input file, address or other resource does not exist.73β Cannot create output file.75β There was some temporary error, check logs.76β Protocol error during remote host connection.77β Permission error.78β Configuration error.127β Unknown error.
π FILES π
/etc/dovecot/dovecot.confβ Dovecot's main configuration file./etc/dovecot/conf.d/90-sieve.confβ Sieve interpreter settings (included from Dovecot's main configuration file)
bestie we're not even done yet, part 2 is loadingβ¦ π
π REPORTING BUGS π
okay bestie, found a bug? first of all, thank you for your service π«Ά do NOT just scream into the void β take it to the Dovecot Mailing List at dovecot@dovecot.org.
and listen, this part is important: when you report it, include your doveconf -n output. like, yes, all of it. no gatekeeping your config, that's literally the whole point π
all the deets on how to report bugs properly live right here:
https://dovecot.org/bugreport.html
β¨ lowkey obsessed with a well-formed bug report. it's giving main character energy and it makes everybody's life easier. slay. π
π SEE ALSO π
the extended universe, fr fr β go read these too:
and that's the whole page, bestie!! you made it to the end, which honestly?? iconic behavior π
this lil masterpiece is SIEVE-FILTER(1), sittin' pretty at revision f00471c, stamped August 2026 π go forth and filter those emails, you absolute legend π¦β¨π
π¦ where this page comes from
- alpine 3.23: dovecot-doc 2.4.5-r0 Β· MIT AND LGPL-2.1-or-later
- alpine 3.24: dovecot-doc 2.4.5-r0 Β· MIT AND LGPL-2.1-or-later
- arch rolling: pigeonhole 2.4.5-1 Β· LGPL-2.1-only
- fedora 43: dovecot-pigeonhole 1:2.4.5-1.fc43 Β· MIT AND LGPL-2.1-only
- fedora 44: dovecot-pigeonhole 1:2.4.5-1.fc44 Β· MIT AND LGPL-2.1-only
- nixos 26.05: dovecot-pigeonhole 2.4.5
- nixpkgs unstable: dovecot-pigeonhole 2.4.5
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms