Below are some simple Sieve code examples, more can be found at http://sieve.info/examplescripts
The Pigeonhole project provides Sieve support as a plugin for Dovecot's Local Delivery Agent (LDA) and also for its LMTP service. The plugin implements a Sieve interpreter, which filters incoming messages using a script specified in the Sieve language (RFC 5228). The Sieve script is provided by the user and, using that Sieve script, the user can customize how incoming messages are handled. Messages can be delivered to specific folders, forwarded, rejected, discarded, etc.
The famous ISP-style mail server tutorial lives here. Learn how to set up your own fully-functional mail server using Postfix, Dovecot IMAP/POP3 and MySQL backend on a Debian server just like your favorite mail or website hosting provider. This guide is a voluntary project with no profit in mind. Go ahead and learn to run your own mail server within hours.
Poolmon is a director mailserver pool monitoring script for Dovecot, meant to
roughly duplicate the functionality of node health monitors on dedicated load-
balancers like LVS or F5 BigIP LTM. This script can be safely run on more than
one director host simultaneously, although differences in node reachability may
result in mailserver vhost count flapping.
Consult the help text for more details on functionality.