<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Good morning,<br><br><br>So......<br><br>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<br><br>Created the following sieve script file (sorry I just realized i have two requires with the same info at top :S):<br><br>require ["fileinto"];<br>require "fileinto";<br>&nbsp; if exists "X-Spam-Flag" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if header :contains "X-Spam-Flag" "NO" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileinto "user.techsupport.SPAM";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stop;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br>if header :contains "From" "MAILER-DAEMON"<br>{<br>fileinto&nbsp; "INBOX.MAILER-DAEMON";<br>}<br>if header :contains "From" "logwatch"<br>{<br>fileinto&nbsp; "INBOX.Server Logs";<br>}<br>if header :contains "From" "root"<br>{<br>fileinto&nbsp; "INBOX.Server Logs";<br>}<br><br><br>then:<br><br>prompt&gt; sieveshell -u techsupport localhost<br>connecting to localhost<br>Please enter your password: <br>&gt; put techsupport.txt phpscript<br>&gt; quit<br><br>Now... the test emails are going into the right folder. <br><br>Questions, should I not be able to add global sieve rules like such?<br><br><br>prompt&gt;&nbsp; sieveshell localhost<br>connecting to localhost<br>Please enter your password: <br>&gt; put techsupport.txt phpscript<br>&gt; quit<br><br>In my global sieve directory: /var/lib/imap/sieve/global<br>I have the following three files<br><br>lrwxrwxrwx 1 cyrus mail&nbsp; 12 2013-04-19 08:27 defaultbc -&gt; phpscript.bc<br>-rw------- 1 cyrus mail 184 2013-04-19 08:26 phpscript.bc<br>-rw------- 1 cyrus mail 194 2013-04-19 08:26 phpscript.script<br><br>and the content of phpscript.script is:<br><br>require "fileinto";<br>&nbsp; if exists "X-Spam-Flag" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if header :contains "X-Spam-Flag" "NO" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileinto "user.techsupport.SPAM";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stop;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br><br><br>which is the one I created yesterday, and loaded using sieveshell.<br><br>any help would be greatly appreciated. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">From: shashaness@hotmail.com<br>To: info-cyrus@lists.andrew.cmu.edu<br>Subject: Global Sieve script<br>Date: Wed, 17 Apr 2013 16:56:07 -0400<br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Good afternoon all,<br><br>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:<br><br><a href="http://cyrusimap.web.cmu.edu/mediawiki/index.php/Cyrus_Sieve" target="_blank">http://cyrusimap.web.cmu.edu/mediawiki/index.php/Cyrus_Sieve</a><br><br><a href="http://oregonstate.edu/helpdocs/e-mail/onid-e-mail/modifying-your-email-filters-using-sieveshell" target="_blank">http://oregonstate.edu/helpdocs/e-mail/onid-e-mail/modifying-your-email-filters-using-sieveshell</a><br><br>So here is what I did:<br><br>[shawn@postoffice ~]$ sieveshell -u shawn localhost<br>connecting to localhost<br>Please enter your password: <br>&gt; list<br>phpscript&nbsp; &lt;- active script<br>&gt; get phpscript phpscript.txt<br>&gt; exit<br><br>[shawn@postoffice ~]$ more phpscript.txt <br># This script has been automatically generated by avelsieve<br># (Sieve Mail Filters Plugin for Squirrelmail)<br># Warning: If you edit this manually, then the changes will not <br># be reflected in the users' front-end!<br>#AVELSIEVE_VERSIONYTo0OntzOjU6Im1ham9yIjtpOjE7czo1OiJtaW5vciI7aTo5O3M6NzoicmVsZWFzZSI7aTo5O3M6Njoic3<br>RyaW5nIjtzOjU6IjEuOS45Ijt9<br>#AVELSIEVE_CREATED1342104019<br>#AVELSIEVE_MODIFIED1351180357<br>require ["fileinto","envelope","reject","vacation","imapflags","relational","comparator-i;ascii-nume<br>ric","regex","notify"];<br>#START_SIEVE_RULEYTo1OntzOjQ6ImNvbmQiO2E6MTp7aTowO2E6NTp7czo0OiJraW5kIjtzOjc6Im1lc3NhZ2UiO3M6NDoidHl<br>wZSI7czo2OiJoZWFkZXIiO3M6NjoiaGVhZGVyIjtzOjExOiJYLVNwYW0tRmxhZyI7czo5OiJtYXRjaHR5cGUiO3M6MjoiaXMiO3M<br>6MTE6ImhlYWRlcm1hdGNoIjtzOjM6IllFUyI7fX1zOjQ6InR5cGUiO3M6MToiMSI7czo5OiJjb25kaXRpb24iO3M6MzoiYW5kIjt<br>zOjY6ImFjdGlvbiI7czoxOiI1IjtzOjY6ImZvbGRlciI7czoxMDoiSU5CT1guU1BBTSI7fQ%3D%3DEND_SIEVE_RULE<br>if header :is "X-Spam-Flag" "YES"<br>{<br>fileinto&nbsp; "INBOX.SPAM";<br>}<br><br><br>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:<br><br>require ["fileinto","envelope","reject","vacation","imapflags","relational","comparator-i;ascii-nume<br>ric","regex","notify"];<br>if exists "X-Spam-Flag" {<br>&nbsp;&nbsp;&nbsp; if header :contains "X-Spam-Flag" "YES"<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; fileinto&nbsp; "user.techsupport.SPAM";<br>&nbsp;&nbsp;&nbsp; stop;<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br>then<br><br>[shawn@postoffice ~]$ sieveshell -u shawn localhost<br>connecting to localhost<br>Please enter your password: <br>&gt; put phpscript.txt phpscript<br>&gt; list<br>phpscript&nbsp; &lt;- active script<br>&gt; quit<br><br><br>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. <br><br>Any help is greatly appreciated,&nbsp; <br>Shawn<br><br><br><br><br><br><br><br><br><br><br><br><br>require "fileinto";<br>&nbsp; if exists "X-Spam-Flag" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if header :contains "X-Spam-Flag" "NO" {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fileinto "user.techsupport.SPAM";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stop;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br><br>                                               </div></div>                                               </div></body>
</html>