[Dovecot] global sieve script

Lars Stavholm stava at telcotec.se
Mon Oct 8 12:55:51 EEST 2007


Jorge Salamero Sanz wrote:
> hi all,
> 
> i'm moving from a maildrop+courier setup to lda(sieve)+dovecot setup.
> 
> with maildrop i had a global filter for all the users, so i could filter and 
> archive into the spam folder spam tagged emails for users without custom 
> filters, including them if they exist:
> 
> LOGNAME=tolower($LOGNAME)
> 
> `test -e $LOGNAME`
> if ( $RETURNCODE != 0 )
> {
>    `maildirmake $LOGNAME`
>    `maildirmake $LOGNAME/._spam`
> }
> 
> `test -f $LOGNAME/mailfilter`
> if ( $RETURNCODE == 0 )
> {
>         include "$LOGNAME/mailfilter"
> }
> 
> if ( /^X-Spam-Status: YES */)
> {
>                 to "$LOGNAME/._spam"
> }
> else
> {
>         to "$LOGNAME/"
> }
> 
> how could i get this behaviour with dovecot lda and sieve ?

For example:

/etc/dovecot/dovecot.conf:
...
protocol lda {
  ...
  sieve_global_path = /etc/dovecot/sieve/
  ...
}


/etc/dovecot/global:
if header :contains "X-Spam-Flag" "YES" {
  fileinto "Spam";
  stop;
}

...or something similar.
/L



More information about the dovecot mailing list