sieve: Examples
4 Examples
**********
If you are not familiar with Sieve, this chapter contains a few simple
code snippets that you can cut’n’paste and modify at will, until you
feel more comfortable with the Sieve language to write the rules from
scratch.
The following complete Sieve script places all messages with a
matching ‘Sender:’ header into the given mailbox. Many mailing lists
uses this format. The first line makes sure your Sieve server
understands the ‘fileinto’ command.
require "fileinto";
if address "sender" "owner-w3-beta@xemacs.org" {
fileinto "INBOX.w3-beta";
}
A few mailing lists do not use the ‘Sender:’ header, but has a unique
identifier in some other header. The following is not a complete
script, it assumes that ‘fileinto’ has already been required.
if header :contains "Delivered-To" "auc-tex@sunsite.dk" {
fileinto "INBOX.auc-tex";
}
At last, we have the hopeless mailing lists that does not have any
unique identifier and you are forced to match on the ‘To:’ and ‘Cc’
headers. As before, this snippet assumes that ‘fileinto’ has been
required.
if address ["to", "cc"] "kerberos@mit.edu" {
fileinto "INBOX.kerberos";
}