Re: FW: Global Sieve script
Hi! The sieve scripts in global namespace don't work for any user unless that user explicitely includes the global sieve script in their own sieve script. You can't just create a global sieve script and expect it to apply for all your users; you're going to have to create a way to modify the sieve script of each user to include your global sieve script (should be easy with the excellent perl modules, see their documentation). And then there's always the option for your users to remove that include rule. For shared mailboxen, you can add an annotation. The name of the annotation is 'sieve' and the value is the name of the sieve script. See man Cyrus::IMAP::Admin, command mboxcfg, for how to add annotations. --Janne On Fri, Apr 19, 2013 at 12:14:22PM -0400, Shawn Bakhtiar wrote: Good morning, So.. in trying to figure this out this morning I did the following and was able to get mail filtered into techsupports SPAM folder, but I don't understand why the global sieve script does not do the same things Created the following sieve script file (sorry I just realized i have two requires with the same info at top :S): require [fileinto]; require fileinto; if exists X-Spam-Flag { if header :contains X-Spam-Flag NO { } else { fileinto user.techsupport.SPAM; stop; } } if header :contains From MAILER-DAEMON { fileinto INBOX.MAILER-DAEMON; } if header :contains From logwatch { fileinto INBOX.Server Logs; } if header :contains From root { fileinto INBOX.Server Logs; } then: prompt sieveshell -u techsupport localhost connecting to localhost Please enter your password: put techsupport.txt phpscript quit Now... the test emails are going into the right folder. Questions, should I not be able to add global sieve rules like such? prompt sieveshell localhost connecting to localhost Please enter your password: put techsupport.txt phpscript quit In my global sieve directory: /var/lib/imap/sieve/global I have the following three files lrwxrwxrwx 1 cyrus mail 12 2013-04-19 08:27 defaultbc - phpscript.bc -rw--- 1 cyrus mail 184 2013-04-19 08:26 phpscript.bc -rw--- 1 cyrus mail 194 2013-04-19 08:26 phpscript.script and the content of phpscript.script is: require fileinto; if exists X-Spam-Flag { if header :contains X-Spam-Flag NO { } else { fileinto user.techsupport.SPAM; stop; } } which is the one I created yesterday, and loaded using sieveshell. any help would be greatly appreciated. From: shashan...@hotmail.com To: info-cyrus@lists.andrew.cmu.edu Subject: Global Sieve script Date: Wed, 17 Apr 2013 16:56:07 -0400 Good afternoon all, I am trying to configure a global sieve script to move all incoming emails to a particular folder. According to the following link this should be a slam dunk: http://cyrusimap.web.cmu.edu/mediawiki/index.php/Cyrus_Sieve http://oregonstate.edu/helpdocs/e-mail/onid-e-mail/modifying-your-email-filters-using-sieveshell So here is what I did: [shawn@postoffice ~]$ sieveshell -u shawn localhost connecting to localhost Please enter your password: list phpscript - active script get phpscript phpscript.txt exit [shawn@postoffice ~]$ more phpscript.txt # This script has been automatically generated by avelsieve # (Sieve Mail Filters Plugin for Squirrelmail) # Warning: If you edit this manually, then the changes will not # be reflected in the users' front-end! #AVELSIEVE_VERSIONYTo0OntzOjU6Im1ham9yIjtpOjE7czo1OiJtaW5vciI7aTo5O3M6NzoicmVsZWFzZSI7aTo5O3M6Njoic3 RyaW5nIjtzOjU6IjEuOS45Ijt9 #AVELSIEVE_CREATED1342104019 #AVELSIEVE_MODIFIED1351180357 require [fileinto,envelope,reject,vacation,imapflags,relational,comparator-i;ascii-nume ric,regex,notify]; #START_SIEVE_RULEYTo1OntzOjQ6ImNvbmQiO2E6MTp7aTowO2E6NTp7czo0OiJraW5kIjtzOjc6Im1lc3NhZ2UiO3M6NDoidHl wZSI7czo2OiJoZWFkZXIiO3M6NjoiaGVhZGVyIjtzOjExOiJYLVNwYW0tRmxhZyI7czo5OiJtYXRjaHR5cGUiO3M6MjoiaXMiO3M 6MTE6ImhlYWRlcm1hdGNoIjtzOjM6IllFUyI7fX1zOjQ6InR5cGUiO3M6MToiMSI7czo5OiJjb25kaXRpb24iO3M6MzoiYW5kIjt zOjY6ImFjdGlvbiI7czoxOiI1IjtzOjY6ImZvbGRlciI7czoxMDoiSU5CT1guU1BBTSI7fQ%3D%3DEND_SIEVE_RULE if header :is X-Spam-Flag YES { fileinto INBOX.SPAM; } At this point I am a little baffled, since this should be moving all X-Spam-Flag that are YES into a folder INBOX.SPAM which does not exists at the top level (although I assume this means it should be filtered into each users individual SPAM folder). I am using Squirrelmail as a web based from end for my remote users and imagine the package manager must have installed this at some point. To simplify my life I re-wrote the script as: require [fileinto,envelope,reject,vacation,imapflags,relational,comparator-i;ascii-nume ric,regex,notify]; if exists X-Spam-Flag { if
FW: Global Sieve script
Good morning, So.. in trying to figure this out this morning I did the following and was able to get mail filtered into techsupports SPAM folder, but I don't understand why the global sieve script does not do the same things Created the following sieve script file (sorry I just realized i have two requires with the same info at top :S): require [fileinto]; require fileinto; if exists X-Spam-Flag { if header :contains X-Spam-Flag NO { } else { fileinto user.techsupport.SPAM; stop; } } if header :contains From MAILER-DAEMON { fileinto INBOX.MAILER-DAEMON; } if header :contains From logwatch { fileinto INBOX.Server Logs; } if header :contains From root { fileinto INBOX.Server Logs; } then: prompt sieveshell -u techsupport localhost connecting to localhost Please enter your password: put techsupport.txt phpscript quit Now... the test emails are going into the right folder. Questions, should I not be able to add global sieve rules like such? prompt sieveshell localhost connecting to localhost Please enter your password: put techsupport.txt phpscript quit In my global sieve directory: /var/lib/imap/sieve/global I have the following three files lrwxrwxrwx 1 cyrus mail 12 2013-04-19 08:27 defaultbc - phpscript.bc -rw--- 1 cyrus mail 184 2013-04-19 08:26 phpscript.bc -rw--- 1 cyrus mail 194 2013-04-19 08:26 phpscript.script and the content of phpscript.script is: require fileinto; if exists X-Spam-Flag { if header :contains X-Spam-Flag NO { } else { fileinto user.techsupport.SPAM; stop; } } which is the one I created yesterday, and loaded using sieveshell. any help would be greatly appreciated. From: shashan...@hotmail.com To: info-cyrus@lists.andrew.cmu.edu Subject: Global Sieve script Date: Wed, 17 Apr 2013 16:56:07 -0400 Good afternoon all, I am trying to configure a global sieve script to move all incoming emails to a particular folder. According to the following link this should be a slam dunk: http://cyrusimap.web.cmu.edu/mediawiki/index.php/Cyrus_Sieve http://oregonstate.edu/helpdocs/e-mail/onid-e-mail/modifying-your-email-filters-using-sieveshell So here is what I did: [shawn@postoffice ~]$ sieveshell -u shawn localhost connecting to localhost Please enter your password: list phpscript - active script get phpscript phpscript.txt exit [shawn@postoffice ~]$ more phpscript.txt # This script has been automatically generated by avelsieve # (Sieve Mail Filters Plugin for Squirrelmail) # Warning: If you edit this manually, then the changes will not # be reflected in the users' front-end! #AVELSIEVE_VERSIONYTo0OntzOjU6Im1ham9yIjtpOjE7czo1OiJtaW5vciI7aTo5O3M6NzoicmVsZWFzZSI7aTo5O3M6Njoic3 RyaW5nIjtzOjU6IjEuOS45Ijt9 #AVELSIEVE_CREATED1342104019 #AVELSIEVE_MODIFIED1351180357 require [fileinto,envelope,reject,vacation,imapflags,relational,comparator-i;ascii-nume ric,regex,notify]; #START_SIEVE_RULEYTo1OntzOjQ6ImNvbmQiO2E6MTp7aTowO2E6NTp7czo0OiJraW5kIjtzOjc6Im1lc3NhZ2UiO3M6NDoidHl wZSI7czo2OiJoZWFkZXIiO3M6NjoiaGVhZGVyIjtzOjExOiJYLVNwYW0tRmxhZyI7czo5OiJtYXRjaHR5cGUiO3M6MjoiaXMiO3M 6MTE6ImhlYWRlcm1hdGNoIjtzOjM6IllFUyI7fX1zOjQ6InR5cGUiO3M6MToiMSI7czo5OiJjb25kaXRpb24iO3M6MzoiYW5kIjt zOjY6ImFjdGlvbiI7czoxOiI1IjtzOjY6ImZvbGRlciI7czoxMDoiSU5CT1guU1BBTSI7fQ%3D%3DEND_SIEVE_RULE if header :is X-Spam-Flag YES { fileinto INBOX.SPAM; } At this point I am a little baffled, since this should be moving all X-Spam-Flag that are YES into a folder INBOX.SPAM which does not exists at the top level (although I assume this means it should be filtered into each users individual SPAM folder). I am using Squirrelmail as a web based from end for my remote users and imagine the package manager must have installed this at some point. To simplify my life I re-wrote the script as: require [fileinto,envelope,reject,vacation,imapflags,relational,comparator-i;ascii-nume ric,regex,notify]; if exists X-Spam-Flag { if header :contains X-Spam-Flag YES { fileinto user.techsupport.SPAM; stop; } } then [shawn@postoffice ~]$ sieveshell -u shawn localhost connecting to localhost Please enter your password: put phpscript.txt phpscript list phpscript - active script quit However, users are still receiving emails marked as SPAM in their inbox. What I am trying to do is make it so that any and all emails marked as SPAM are redirected to a single folder called SPAM in the techsupport users mail store. Any help is greatly appreciated, Shawn require fileinto; if exists X-Spam-Flag { if header :contains X-Spam-Flag NO { } else { fileinto user.techsupport.SPAM; stop; } } Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To