Sieve Examples Edit
Welcome to the Sieve Examples page of the Fastmail Wiki. In here you'll find a collection of links to various examples of Sieve code, hosted on this wiki. If you need more general help with Sieve, please take a look at the Sieve F.A.Q. A list of links, some of which providing examples, can be found there as part of the References section. Scripts that contain profanity (in order to detect it being used in mail messages) have been marked with a !.
Simple Examples Edit
!An extract from SanjaySheth's personal sieve script used for filtering blatant spam.
Snippet for adding vacation messages to your sieve script.
Highly recommended! Small snippets of code, for many small tasks.
Simple script featuring various checks, and a redirect for archiving purposes.
Uses list of subject keywords and :regex to filter spam. It's posted in a forum discussion.
Advanced Examples Edit
==Secure Disposable Email Addresses (AKA Tagged Email Addresses, per-recipient Email Addresses, or DEAs) SieveChecksums shows how to use Sieve to enable secure DEAs that you don't have to create manually. Magic!
Filter Mailing Lists into Folders Edit
"The following extract files messages from all the mailing lists I am on (and thats a lot) each into their own folder. I use Maildir format mailboxes, and the lists are all subfolders under the list folder under INBOX. The list names are sanitized (to prevent someone trying to write stuff into ../../something or similar — if they do not match a basic string then stuff is filed into .list.unknown (pretty much nothing hits that at present)."
See the Exim wiki (example in Exim and Sieve format).
See his Sieve Webpage.
For a mid-level overview of how MrElvey uses sieve to handle email, see SpamCountermeasures.
'Salient parts' of the Sieve script by an author whose name is unfortunately lost in the records.
MatthewJohnson's Example Sieve Script.Edit
See MatthewJohnson for the script he uses on FastMail.fm. It features a way to manage multiple domains hosted at one account, using a catch-all alias for each. This way he can easily create new disposable addresses. It also uses spamfiltering spam by score, domain, by character encoding, whitelisting, whitelisting by fastmail addressbook, greylisting and blacklisting, to arange mail into folders, and to forward to sms.
Michael Klose's Sieve script. (Note: This page used to contain discussion about this script; the discussion has been moved to Talk:MichaelKloseSieveScript; Note to people coming in from the Cyrusoft Website: This is the script you're looking for, it has been moved around to get some order in the chaos of this wiki)
Time-sensitiveNotification Example Edit
An example of a rule that works only during specified time-periods.