dovecot dspam plugin

I’ve found the dovecot dspam plugin and looked at the code. It forks and calls the dspam binary directly for every mail. I didn’t like this behavior, so
I’ve migrated it to use libdspam and added support to configure it using variables in dovecot.conf.

This is the dovecot dspam plugin that watches a special folder, the SPAM folder. When the MTA delivers a message to the user, it’ll first run it through the spam classifier. If it is classified as spam, it’ll be delivered to the SPAM folder instead of the normal filtering file the user may have (maildrop, sieve). Now the user has everything classified as spam in his SPAM folder. Everything else wherever the users wants it.

This is not enough cause our spam scanner needs training. We’ll occasionally have false positives and false negatives. Now this is the point where the dovecot dspam plugin comes into play. Instead of moving mail into special folders, the user has two actions available:

  1. moving it out of the SPAM folder and
  2. moving it into the SPAM folder.

The dovecot plugin watches these actions (and additionally prohibits APPENDs to the SPAM folder, more for technical reasons than others) and tells dspam that it made an error and needs to re-classify the message, depending on which of the two actions the user did. The user can now move the message directly into whatever folder the user chooses, and it all works.


Johannes has written a new plugin and we have merged pieces of the code, please check:

You may also like...

5 Responses

  1. Eugene Prokopiev says:

    This is very interesting but I can’t clone repo:

    $ git clone git://
    Initialized empty Git repository in /home/enp/alt-devel/git/dovecot-dspam-plugin/.git/[0:]: errno=Connection refused
    fatal: unable to connect a socket (Connection refused)
    fetch-pack from ‘git://’ failed.

    $ ping
    PING ( 56(84) bytes of data.
    64 bytes from ( icmp_seq=1 ttl=49 time=113 ms

    Can I download sources in any way?

  2. Peter says:

    Does this plugin work with Dovecot 1.1?

  3. gangan says:

    i have a bug 🙁

    make install
    cc -DHAVE_CONFIG_H -I/opt/dovecot/include/ -I/opt/dovecot/include/src/ -I/opt/dovecot/include/src/lib/ -I/opt/dovecot/include/src/lib-storage/ -I/opt/dovecot/include/src/lib-mail/ -I/opt/dovecot/include/src/lib-imap/ -I/opt/dovecot/include/src/lib-dict/ -I/opt/dovecot/include/src/lib-index/ -I/opt/dovecot/include/src/imap/ -o dovecot-version dovecot-version.c
    dovecot-version.c:4:20: erreur: config.h : Aucun fichier ou r?pertoire de ce type
    dovecot-version.c: In function ‘main’:
    dovecot-version.c:8: erreur: ‘PACKAGE_STRING’ undeclared (first use in this function)
    dovecot-version.c:8: erreur: (Each undeclared identifier is reported only once
    dovecot-version.c:8: erreur: for each function it appears in.)
    make: *** [dovecot-version] Erreur 1

  4. GlaDiaC says:

    This doesn’t really work. For dovecot antispam take a look at

Leave a Reply

Your email address will not be published. Required fields are marked *