Sieve
Sieve scripts belong into the virtual users homedir and should be named .dovecot.sieve
To do some basic sorting for tags and / or spam flags use scripts similiar to this:
require "fileinto";
#if header :contains "subject" ["foo", "bar"] {
# fileinto "foofolder";
#}
#if header :matches "Subject" ["*foo*","*bar*"]) {
# fileinto "foofolder";
#}
if header :contains "X-Spam-Flag" "Yes" {
fileinto "Spam";
stop;
}
Note that this assumes that you have a working spamassassin setup.