Skip to content

Move SPAM to Junk folder and mark as read

Published on: July 5, 2009 | Last modified on: July 5, 2009

Using Dovecot Sieve, you can easily move all spam to a Junk folder, and mark the spam messages as read:

1
2
3
4
5
if header :contains "X-DSPAM-Result" "Spam" {
  setflag "\\Seen";
  fileinto "Junk";
  stop;
}

I generally define this rule globally for all users. I use DSPAM, but this can easily be adapted to other spam filtering tools, provided they add extra headers in the filtered mail.