Spam learning by moving to/from junkmail

tags/smeserver-dovecot-extras-0.1.4-1
Daniel Berteaud 8 years ago
parent 707b99966c
commit fca6acab5c
  1. 52
      root/etc/e-smith/templates/etc/dovecot/dovecot.conf/70pluginImapSieve
  2. 1
      root/usr/libexec/dovecot/learn-ham.sh
  3. 1
      root/usr/libexec/dovecot/learn-spam.sh
  4. 8
      root/usr/libexec/dovecot/sieve/report-ham.sieve
  5. 2
      root/usr/libexec/dovecot/sieve/report-spam.sieve

@ -0,0 +1,52 @@
{
# If we have imap_sieve plugin, enable it
if (( -e '/usr/lib64/dovecot/lib95_imap_sieve_plugin.so' || -e '/usr/lib/dovecot/lib95_imap_sieve_plugin.so') &&
($spamassassin{'UseBayes'} || 'disabled') =~ m/^1|on|yes|enabled$/){
push @imap_plugins, 'imap_sieve';
my $index = 1;
$OUT.= <<'_EOF';
plugin {
sieve_plugins = sieve_imapsieve sieve_extprograms
sieve_execute_bin_dir = /usr/libexec/dovecot
sieve_pipe_bin_dir = /usr/libexec/dovecot
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.execute
_EOF
if (($dovecot{'LearnSpam'} || 'enabled') =~ m/^1|on|yes|enabled$/){
$OUT.= <<"_EOF";
# Copy from anywhere to junkmail
imapsieve_mailbox$index\_name = junkmail
imapsieve_mailbox$index\_causes = COPY
imapsieve_mailbox$index\_before = file:/usr/libexec/dovecot/sieve/report-spam.sieve
_EOF
$index++;
$OUT.= <<"_EOF";
imapsieve_mailbox$index\_name = Junk
imapsieve_mailbox$index\_causes = COPY
imapsieve_mailbox$index\_before = file:/usr/libexec/dovecot/sieve/report-spam.sieve
_EOF
$index++;
}
if (($dovecot{'LearnHam'} || 'enabled') =~ m/^1|on|yes|enabled$/){
$OUT.= <<"_EOF";
# Copy from junkmail to anywhere
imapsieve_mailbox$index\_name = *
imapsieve_mailbox$index\_from = junkmail
imapsieve_mailbox$index\_causes = COPY
imapsieve_mailbox$index\_before = file:/usr/libexec/dovecot/sieve/report-ham.sieve
_EOF
$index++;
$OUT.= <<"_EOF";
imapsieve_mailbox$index\_name = *
imapsieve_mailbox$index\_from = Junk
imapsieve_mailbox$index\_causes = COPY
imapsieve_mailbox$index\_before = file:/usr/libexec/dovecot/sieve/report-ham.sieve
_EOF
$index++;
}
$OUT .= '}';
}
}

@ -0,0 +1 @@
exec /usr/bin/spamc -L ham

@ -0,0 +1 @@
exec /usr/bin/spamc -L spam

@ -0,0 +1,8 @@
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
if string "${mailbox}" "Trash" {
stop;
}
pipe :copy "learn-ham.sh";

@ -0,0 +1,2 @@
require ["vnd.dovecot.pipe", "copy"];
pipe :copy "learn-spam.sh";
Loading…
Cancel
Save