root@mail:/# cat /var/spool/vmail/sieve/global.sieve
require "fileinto";

if exists "X-Spam-Flag" {
	if header :contains "X-Spam-Flag" "YES" {
		fileinto "Spam";
		stop;
	}
}
root@mail:/# cat /etc/dovecot/dovecot.conf
protocol lda {
  mail_plugins = sieve
}

plugin {
  sieve_before = /var/spool/vmail/sieve/global.sieve
  sieve = /var/spool/vmail/%d/%n/user.sieve
  sieve_global_dir = /var/spool/vmail/sieve/
  sieve_dir = /var/spool/vmail/%d/%n/
}