This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.

Antispam plugin


The antispam plugin allows you to retrain the spam filter by simply moving emails in and out of the Spam folder. The original project can be found HERE.

Getting the sources

Currently there are no antispam-plugin releases for v2.0, but you can get them from the the Mercurial repository:

# hg clone
# cd dovecot-antispam-plugin


If you downloaded the sources using Mercurial, you will need to execute ./ first to build the automake structure in your source tree. This process requires autotools and libtool to be installed.

# ./

If you installed Dovecot from sources, antispam-plugin's configure script should be able to find the files it needs automatically

# ./configure
# make
# make install

If this doesn't work, you can use the --prefix=<path> configure option:

# ./configure --prefix=/usr
# make
# make install

If you get a DC_DOVECOT: not found" error message when running configure, make sure dovecot.m4 is in your aclocal folder.

Configuration and Use


protocol imap {
  mail_plugins = $mail_plugins antispam


The original man page can be found HERE

Here is an example using the mailtrain backend

plugin {
  antispam_backend = mailtrain
  antispam_mail_notspam = nospam-%u
  antispam_mail_sendmail = /usr/sbin/sendmail
  antispam_mail_spam = spam-%u
  antispam_mail_tmpdir = /tmp
  antispam_signature = X-DSPAM-Signature
  antispam_signature_missing = move
  antispam_spam_pattern_ignorecase = INBOX.spam;INBOX.junk;spam;junk
  antispam_trash_pattern_ignorecase = trash;deleted