[Dovecot] Antispam plugin + scriptsieve

Allan Cassaro allan.cassaro at gmail.com
Wed Dec 3 21:46:23 EET 2008


Hi,

I wrote a little python program that works with antispam plugin, to
create or remove sieve rules based on "From:" of any e-mail that is
moved to some folder configured in dovecot.conf.

He works fine with "Felamimail" the email program of "eGroupware".

After setup, is very simple:

If an user move a message to "blocked" folder, is appended a rule in
the script sieve of this user.
If the message is deleted or moved out that folder, the rule is removed too.

The setup is very simple:
(after setup antispam plugin)

Change this in dovecot.conf:

protocol imap {
  mail_plugins = antispam
}

plugin {
  antispam_spam = Blocked
  antispam_mail_sendmail = /usr/libexec/dovecot/blockthis.py
  antispam_mail_sendmail_args = -u;%u
  antispam_mail_spam = -a
  antispam_mail_notspam = -d
}

Hooo... this script create a "include global script" statament in
script sieve...
If you don't want this feature, just comment this 2 lines:

sievelist.append('require ["fileinto", "include"];\n')
sievelist.append('include :global "global.sieve";\n')

Here  this is very useful! :D

This script was created to suit my needs, so, have some paths in the code...
It's not very "user friendly" yet... but if have intereting I will
implement others features (like a config file).

Download here:
http://allan.cassaro.googlepages.com/blockthis.py

Regards.


More information about the dovecot mailing list