I am setting up a spam filter on my email server but cannot get sieve to sort the mails. All spams are delivered straight to the inbox despite rules written in .dovecot.sieve
. In mail logs Postfix reports that spams (marked with X-Spam-Flag
in their headers) are successfully delivered to maildir, and Dovecot reports no error at all. Dovecot version is 2.3.13 (89f716dc2). Please advise.
/etc/postfix/main.cf:
mailbox_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = domain
virtual_mailbox_base = /home/vmail
/etc/dovecot/dovecot.conf:
protocols = imap lmtp
/etc/dovecot/conf.d/10-master.conf:
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0666
}
}
/etc/dovecot/conf.d/10-mail.conf:
mail_home = /home/vmail/%d/%n/home
mail_location = maildir:/home/vmail/%d/%n
/etc/dovecot/conf.d/20-lmtp.conf:
protocol lmtp {
mail_plugins = $mail_plugins sieve
}
/etc/dovecot/conf.d/90-sieve.conf:
sieve = ~/.dovecot.sieve
/home/vmail/domain.com/user1/home/.dovecot.sieve:
require ["fileinto"];
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
stop;
}