parent
707b99966c
commit
fca6acab5c
5 changed files with 64 additions and 0 deletions
@ -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…
Reference in new issue