Search K
Appearance
Appearance
sieve-test [options] script-file mail-file
The sieve-test command is part of Pigeonhole (pigeonhole(7)
), which adds Sieve (RFC 5228) and ManageSieve (RFC 5804) support to Dovecot (dovecot(1)
).
Using the sieve-test command, the execution of Sieve scripts can be tested. This evaluates the script for the provided message, yielding a set of Sieve actions. Unless the -e option is specified, it does not actually execute these actions, meaning that it does not store or forward the message anywhere. Instead, it prints a detailed list of what actions would normally take place. Note that, even when -e is specified, no messages are ever transmitted to remote SMTP recipients. The outgoing messages are always printed to stdout instead.
This is a very useful tool to debug the execution of Sieve scripts. It can be used to verify newly installed scripts for the intended behaviour and it can provide more detailed information about script execution problems that are reported by the Sieve plugin, for example by tracing the execution and evaluation of commands and tests respectively.
sievec(1)
for more information about Sieve compilation.Specifies the 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.
Specifies the file containing the e-mail message to test with.
Using the -t option, the sieve-test tool can be configured to print detailed trace information on the Sieve script execution to a file or standard output. For example, the encountered commands, the performed tests and the matched values can be printed.
The runtime trace can be configured using the -T option, which can be specified multiple times. It can be used as follows:
Set the detail level of the trace debugging. One of the following values can be supplied:
Only print executed action commands, like keep, fileinto, reject and redirect.
Print debug messages as well. This is usually only useful for developers and is likely to produce messy output.
Print byte code addresses for the current trace output. Normally, only the current Sieve source code position (line number) is printed. The byte code addresses are equal to those listed in a binary dump produced using the -d option or by the sieve-dump(1)
command.
To improve script debugging, this Sieve implementation supports a custom Sieve language extension called 'vnd.dovecot.debug'. It adds the debug_log command that allows logging debug messages.
Example:
require "vnd.dovecot.debug";
if header :contains "subject" "hello" {
debug_log "Subject header contains hello!";
}
Tools such as sieve-test, sievec(1)
and sieve-dump(1)
have support for the vnd.dovecot.debug extension enabled by default and it is not necessary to enable nor possible to disable the availability of the debug extension with the -x option. The logged messages are written to stdout in this case.
In contrast, for the actual Sieve plugin for the Dovecot LDA (dovecot-lda(1)
) the vnd.dovecot.debug extension needs to be enabled explicitly using the sieve_extensions
or sieve_global_extensions
setting. The messages are then logged to the user's private script log file. If used in a global script, the messages are logged through the default Dovecot logging facility.
sieve-test will exit with one of the following values:
dovecot(1)
, dovecot-lda(1)
, sieve-dump(1)
, sieve-filter(1)
, sievec(1)
, pigeonhole(7)