Email sieve

From Cncz
Revision as of 00:19, 7 November 2007 by Petervc (talk | contribs)
Jump to: navigation, search

Sieve

If one wants incoming mail to be sorted into folders automatically or to be filtered in some special way, one can use "Sieve" if one has the IMAP-server post.science.ru.nl as incoming mailserver. The Sieve language is described in RFC3028. Below are instructions to activate a Sieve-script:

  • Log in to "solo.science.ru.nl" (or "solost.science.ru.nl" for students)
  • Type:
        /usr/local/cyrus-imapd/bin/sieveshell post.science.ru.nl

and give your password.

  • If you type a '?', you see what to do:
        Usage:
          sieveshell [-u username] [-a authname] [-r realm] <server>
        help             - this screen
        list             - list scripts on server
        put <filename> [<target name>]
                         - upload script to server
        get <name> [<filename>]
                         - get script. if no filename display to stdout
        delete <name>    - delete script
        activate <name>  - set a script as the active script
        deactivate       - deactivate all scripts
        quit             - quit

This is an ftp-like interface to view (get) or upload (put) scripts. One has to be a bit careful changing such a script, because it is quite easy to lose new mail this way.

Examples of Sieve-scripts

  • If some mail should be sorted automatically into an existing folder, one can use a script like:

require [ "fileinto", "include" ];
#
# Messages into folders.
#
if header :contains "X-VirusscanResult" "infected" {
        fileinto "INBOX.Virus";
        stop;
}
include "spam";
include "vacation";

If one wants to redirect all mail that remains after our spamfilter has done its job, one has to add after the include "spam"; line:

redirect "";