This is documentation for an outdated product. See the current documentation

ISPmanager 5 Business Documentation

Mail filtering

 

Sieve

Sieve is used as a mail filter (http://en.wikipedia.org/wiki/Sieve )

The mailbox directory contains the file .dovecot.sieve containing scripts files (in each condition and corresponding action) from the directory .sieve/ and in the mailbox directory.

Into each script into the heading the instruction for activating all the commands that are added in the control panel is specified:

 require ["fileinto","reject","vacation","regex","envelope","relational","body","copy"]

Example

The script "testscript" for the mailbox aaa@test.dom of the user checks the following: if in the message headings "Header" or "Subject" "AAA", "BBB", "ССС" are not found or the message size is more than 1 MB, the message will be sent to bbb@test.dom, and do not save it in aaa@test.dom.

Once the filter script is created in the control panel, the file will contain the following:

/var/www/user/data/email/test.dom/aaa/.dovecot.sieve:

 require ["include"];
 include :personal "testscript";
  • require — specify that the include directive is used for activating the scripts
  • include — activate the testscript script


/var/www/user/data/email/test.dom/aaa/.sieve/testscript.sieve:


 if anyof (	not header :contains ["Header","Subject"]  ["AAA","BBB","CCC"],
 	 size :over 1024K
 ) {	redirect "bbb@test.dom";
 	discard;  
 }


  • anyof — any condition is true

The first condition (each condition starts in a new paragraph comma separated between '(' and ')'):

  • not — inverter
  • header — check email message heading
  • :contains — contains
  • ["Header","Subject"] — check the headings Header or Subject
  • ["AAA","BBB","CCC"] — check that the heading contain "AAA", "BBB" or "ССС"

The second condition:

  • size — check email message size
  • :over — more
  • 1024K — 1 MB

The first action (each action are specified in a new paragraph comma separated between '{' and '}'):

  • redirect — redirect to
  • "bbb@test.dom" — address bbb@test.dom

The second action:

  • discard — delete (do not save into the mailbox for which the script is executed)

In this article