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 globaland 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
Op 13-6-2011 4:41, Dhaval Patel schreef:> -------------------------------------------------------------- > 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?http://wiki.dovecot.org/LDA/Sieve/Dovecot#Executing_Multiple_Scripts_Sequentially Use sieve_before. Script name is mainly important when a directory is specified, in which case it must end with .sieve. The directory/file can be located anywhere you like.> 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?Not like that. There is an include extension, but that is not able to do optional includes (maybe it should). You can use multiscript support for this too. Make the sieve_before setting dependent on the user, make it point to two alternative directories, each containing (symlinks to) a different set of scripts.> 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.Regards, Stephan.