LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

sieve

Email filtering with Sieve language

TLDR

Compile and check a Sieve script for errors
$ sieve --compile-only [path/to/script.sieve]
copy
Compile and dump disassembled Sieve code
$ sieve --dump [path/to/script.sieve]
copy
Run a Sieve script on a mailbox
$ sieve [path/to/script.sieve] [path/to/mailbox]
copy
Filter with verbose output
$ sieve --verbose [path/to/script.sieve] [path/to/mailbox]
copy
Set debug level for tracing
$ sieve --debug=[trace4] [path/to/script.sieve]
copy

SYNOPSIS

sieve [options] script [mailbox]

DESCRIPTION

sieve is a mail filtering tool that processes email using scripts written in the Sieve language (RFC 5228). Sieve is a domain-specific language designed for filtering email messages at delivery time, supporting actions like filing messages into folders, discarding spam, forwarding, and vacation responses.The Sieve language provides conditional branching and pattern matching on message headers and content, but intentionally lacks variables and loops in its base specification to prevent runaway programs. Extensions to the base standard add features like variables, include files, and advanced string manipulation.sieve can compile scripts to check for errors without executing them, or process actual mailboxes. It's commonly used with mail servers like Dovecot (via Pigeonhole) or GNU Mailutils.

PARAMETERS

-c, --compile-only

Compile the script and exit without executing. Used for syntax checking.
-D, --dump
Compile the script and dump disassembled Sieve code to the terminal.
-v, --verbose
Increase verbosity level.
--debug=level
Set debugging level. Sieve-specific levels: trace1 (parse tree before optimization), trace2 (parse tree after optimization), trace3 (parser traces), trace4 (tests and actions executed), trace9 (each instruction executed).
--no-compile-only
Execute the script (disable compile-only mode).
-h, --help
Display help information.
--version
Display version information.

INSTALL

sudo apt install mailutils
copy
sudo pacman -S mailutils
copy
sudo apk add mailutils
copy
sudo zypper install mailutils
copy
brew install mailutils
copy
nix profile install nixpkgs#mailutils
copy

CAVEATS

The Sieve language has intentional limitations for safety: no variables or loops in the base specification. Scripts should be thoroughly tested with --compile-only before deployment. When filtering existing mailboxes, incorrect scripts can result in unintended message deletion. Use simulation modes when available before applying filters to production mailboxes.

HISTORY

The Sieve language was originally standardized in RFC 3028 (January 2001) by the IETF. The base specification was updated in RFC 5228 (2008). The GNU Mailutils implementation provides the sieve command as part of its mail handling suite. Dovecot's Pigeonhole project provides another popular implementation with the sieve-filter command for server-side filtering.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid