a cosmological pedestrian

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:

moving it out of the SPAM folder and

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.

*UPDATE*

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