1 (edited by rex_ray 2010-10-20 10:42:40)

Topic: [Solved] Managesieve Global filter

I've created a filter in "dovecot.sieve" which moves the Spam messages into a user's "Junk" folder automatically. Works as it should no problem. But if that particular user creates a filter using "managesieve" plugin this process breaks. "Per-user preferences over-rides the global sieve rules" yeah I know that too.  My question is,

  Is it possible to create a global or default filter in "managesieve" or "sieverules" roundcube plugin for all the users for moving spam into the junk folder.

   Imagine this if a new user  is created, he logs into his account for the first time, opens the filter options and finds the Spam filter already there to move Spam into Junk folder. Also this can be a nice example for the end user who is "filter impaired". Thanks in advance for the help.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: [Solved] Managesieve Global filter

Reference:
http://wiki.dovecot.org/LDA/Sieve#Include_scripts
http://wiki.dovecot.org/LDA/Sieve/CMU

If you're using Dovecot-1.2, try "sieve_before" or "sieve_after":
http://wiki.dovecot.org/LDA/Sieve/Dovecot

3

Re: [Solved] Managesieve Global filter

ZhangHuangbin wrote:

Reference:
http://wiki.dovecot.org/LDA/Sieve#Include_scripts
http://wiki.dovecot.org/LDA/Sieve/CMU

If you're using Dovecot-1.2, try "sieve_before" or "sieve_after":
http://wiki.dovecot.org/LDA/Sieve/Dovecot

Thanks for the speedy reply am currently experimenting with the "before" & "after" scripts.

4 (edited by rex_ray 2010-10-21 10:25:12)

Re: [Solved] Managesieve Global filter

Found a solution to this problem and thanks to ZhangHuangbin for providing the link.

  1. Upgraded to Dovecot 1.2 using ZhangHuangbin's tutorial, because the following option is only available from that version onwards.

  http://www.iredmail.org/wiki/index.php? … 1.1.to.1.2

2. If you followed the tutorial there should be lines similar to the ones below in your "dovecot.conf" and for those of you who already have dovecot 1.2 change the lines accordingly,

plugin {
   
         #sieve_global_path =
         #sieve_global_dir =
         #sieve_before = /var/vmail/sieve/dovecot.sieve
         
#uncomment the following line and add the directory path which contains the
#script(s) you wish  to run after user's personal scripts.  if not present add the line
            sieve_after = /var/vmail/sieve/after.d/   
 
            sieve = /var/vmail/sieve/%Ld/%Ln/dovecot.sieve
            sieve_dir = /var/vmail/sieve/%Ld/%Ln/
}

3. In my case I copied the "dovecot.sieve" script to the "after.d" directory for testing,

     mkdir /var/vmail/sieve/after.d

     cp -a /var/vmail/sieve/dovecot.sieve /var/vmail/sieve/after.d/

     sievec /var/vmail/sieve/after.d/

     chown -R vmail.vmail /var/vmail/sieve/after.d

     service dovecot restart

What this does is, it'll execute the sieve script "dovecot.sieve" (which I created for moving messages labeled as spam into the "Junk" folder) after executing all the user's personal sieve scripts.
(for example filter scripts created using Roundcube's managesieve plugin).