The sievec command is part of the Sieve implementation for the Dovecot secure
IMAP server. Sieve (RFC 5228) is a simple and highly extensible language for filtering
e-mail messages. It can be implemented for any type of mail access protocol, mail
architecture and operating system. The language cannot execute external programs and in
its basic form it does not provide the means to cause infinite loops, making it suitable
for running securely on mail servers where mail users have no permission run arbitrary programs.
Using the sievec command, Sieve scripts can be compiled into a binary representation.
The resulting binary can be used directly to process e-mail messages during the delivery process.
The delivery of mail messages and therefore also the execution of Sieve scripts is
performed by Dovecots local delivery agent (LDA) called deliver. Usually, it is not
necessary to compile the Sieve script manually using sievec, because deliver will do
this automatically if the binary is missing. However, in some cases deliver does not have
permission to write the compiled binary to disk, forcing it to recompile the script every time it
is executed. Using the sievec tool, this can be performed manually by an authorized user to
The sievec command accepts two arguments: the script-file argument specifies the
script to be compiled and the out-file argument specifies where the (binary) output is to
be written. This Sieve implementation reconizes files with a .sieve extension as Sieve
scripts and corresponding files with a .svbin extension as the associated compiled binary.
This means for example that Dovecots deliver process will look for a binary file dovecot.svbin
when it needs to execute dovecot.sieve. Such filename is chosen automatically for the binary output
when the out-file argument is missing.
If the script-file argument is a directory, all files in that directory with a .sieve
extension are compiled into a corresponding .svbin binary file. The compilation is not halted
upon errors; it attempts to compile as many scripts in the directory as possible. Note that the
-d option and the out-file argument are not allowed when the script-file argument
is a directory.
The sievec command is also useful to verify Sieve scripts before using. Additionally, with
the -d option it can output a textual (and thus human-readable) dump of the generated Sieve
code to the specified file. The output is then identical to what the sieved(1) command produces
for a stored binary file. This output is mainly useful to find bugs in the compiler that yield corrupt