[Dovecot] Sieve question

Dhaval Patel dhaval at patel.sh
Mon Jun 13 05:41:01 EEST 2011


I have successfully setup Postfix -> Dovecot with virtual users and spam
filtering with spamassassin. Now the last remaining part is for the user defined
rules. Let me describe my environment and what I am trying to achieve.

I have Postfix setup to call spamc and deliver to Dovecot according to the
master.cf line below.

--------------------------------------------------------------
dovecot   unix  -       n       n       -       -       pipe
   flags=DRhu user=vmail:vmail argv=/usr/bin/spamc -u vmail -e
/usr/lib/dovecot/deliver -d ${recipient}
--------------------------------------------------------------

The emails get checked by Spamassassin and are delivered to the users's mailbox
(/home/vmail/username). I use an actual username (dhav) and not email address
(dhaval at example.com). Things are working fine with that.

>From reading http://wiki.dovecot.org/LDA/Sieve I see that Sieve can do global
and user specified filtering. So I am planning to put the following rule into
the global script so spammy emails go to the user's INBOX.spam folder.

--------------------------------------------------------------
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
  fileinto "spam";
}
--------------------------------------------------------------

My first question is, where is this global script? Do I configure the
"sieve_global_dir = /etc/dovecot/sieve/"? What about he filename?

Most users will not need any additional rules. There are some users that do and
I am having a difficult time figuring out how it would be setup. My second
question is the following. Is there a way in the global script to check if there
is a file called /etc/dovecot/sieve/username or
/home/vmail/username/personal_sieve_script and include it?


I was using maildrop before this and procmail before that so I apologies for
sounding stupid if this is not how Sieve scripts work.

I am by no means tied the methods I describe above. If anyone knows of a better
way to achieve what I am trying to do, I would appreciate if you let me know of
it.


Thanks,
Dhaval






More information about the dovecot mailing list