Getting Started

Until these pages are fleshed out, the best way to understand jSieve is read the Javadocs and look at the source code. The jUnit tests illustrate many aspects of the implementation.

Using jSieve


org.apache.jsieve.SieveFactory is the primary invocation point for all Sieve operations. The API is clean and simple. See the javadocs for more details.


The SieveToMultiMailbox mailet is included in JAMES. It is integrated with the message delivery spool and provides per-user Sieve scripting using jSieve.

Implementing A Mail Adapter

org.apache.jsieve.mail.MailAdapter is the interface API used by jSieve to interact with a mail server.

The mail adapter wraps an email and supplies information (required by the script) about the email. It is responsible for accumulating Actions during the parsing of a script and for executing them once the parsing is complete.

See the javadocs for more details and this sample.

Creating A Custom Extension Command

org.apache.jsieve.commands.extensions.Log is an example of a custom extension command. It is recommended that custom commands extend AbstractCommand. See the javadocs for more details.

Custom commands need to be registered with ConfigurationManager before they can be used. This may be done programmatically but the recommended method is by altering the org/apache/jsieve/, org/apache/jsieve/ and org/apache/jsieve/ resource files.

Building jSieve

jSieve uses Ant. ant -projecthelp describes appropriate targets. ant runs the default target.

Comments, Questions and Issues

jSieve is a sub-project of Apache James. Please direct your comments and questions to the relevant James list.

To report issues, such as bugs, go to the jSieve Issue Tracker. As jSieve comes with a fairly extensive suite of jUnit Tests, it would be most helpful for bug reports to be accompanied by an illustrative jUnit test case.

Frequently Asked Question

Why Do Tests Using Non-ASCII Characters Fail?

SIEVE specifies that UTF-8 encoding is used for scripts. This format is an international standard and has wide support but not all platforms use this encoding by default.

By default, JSieve expects that scripts are encoding using UTF-8. Either set the encoding programmatically or ensure that the script is encoded using UTF-8.