modifying sieve scripts directly in /var/lib/imap/sieve

Paul Raines raines at nmr.mgh.harvard.edu
Fri Jul 8 11:14:40 EDT 2005


THe most glaring problem with sieve is that folder names to be
sorted into cannot be dynamically determined at script run time
(unless I have missed some extension that does this).

A very common thing people do is to sort incoming email into
folders according to the From address.  Or sorting into a
folder where the name of the folder has the date appended.

Ideally sieve would support something like:

if address :domain :is "From" "mycompany.com" {
   fileinto "INBOX.$fromAddrUser$";
   stop;
}

where $fromAddrUser$ is a macro that gets replaced at runtime by
the first part of the from address (i.e. by 'raines' if the
address is 'raines at mycompany.com')

Or do something like:

fileinto "INBOX.backup.$date[YY-MM]$";
keep;

where $date[{strftime format string}]$ is replaced by the
calculated date string.

It is the later one that is most important to me.    So I was
thinking of a way to hack it by having a cron job on the IMAP server
that at the beginning of each month would take a sieve script
template that might have a rule like above and create a "valid"
sieve script which would have the rule

fileinto "INBOX.backup.05-07";
keep;

and then load it in as my sieve script.  But how to do that last step? 
Writing some kind of Expect script that uses sieveshell would involve me 
having to store my password somewhere on the filesystem which is ugly. 
Ideally the cron job could run as the 'cyrus' user on the IMAP server and 
just write the new sieve script to

/var/lib/imap/sieve/4/raines/backup_script

and run sievec on it to compile it.  Will the imap server instantly
see this change?  Or does it have the scripts cached and needs to
be "notified" somehow that the script has changed?  Is there someway
to notify it of such from the command line?


-- 
---------------------------------------------------------------
Paul Raines                email: raines at nmr.mgh.harvard.edu
MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging
149 (2301) 13th Street     Charlestown, MA 02129	    USA


---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list