Question about Sieve and "filters"

Michael Fair michael at
Wed Jul 9 00:38:16 EDT 2003

Hey all,

I have a general question/suggestion regarding Sieve.

It seems to me that it would be useful to be able
to install filter plugins that could transform
mail messages as they were processed.

This would be a simple command, like:
filter :spamassassin

This command would take the email, shove it through
the "spamassassin" filter on standard in and read
the email back from standard out.  On any kind of 
execution failure it would treat the filter as a 
noop and use the email as it was prior to injection.

It would also be useful for the filter to be able to
communicate information back to the sieve script for
branching or decision making purposes.  To keep the
language ultra simple like it currently is, my first
proposal would be that a filter would insert or change
an email header to add the info that the script would 
then check.  So on the above spamassassin filter the
sieve script post filter command would check the 
"X-Spam-Status" header to see if it contained "Yes,".

Now given that Sieve is also supposed to be used 
from the GUI of email clients to construct filtering
rules, and that filters are variable from one server
to the next, this would require the client to contact
the sieve server and request the list of installed 
filters.  I haven't worked out all the details of how
a client and server exchange this information, especially
how does a server tell a client that list they requested
is now different and it needs to get a new list or what
does a client do when it has a script that uses a filter
that isn't in the list of server choices.  

To get around that I'm thinking that for now, the end user 
just has to magically know (by being told by their 
administrator) what the current list of filters are and the 
client GUI then just has to provide a type in field where 
the end user writes the plugin name.  A drop down list might 
be more user friendly but I think it complicates what is
currently a very simple language.

What do others think about this?
Would this simple "pass through" filtering be useful?
I'm primarily thinking of Spam catchers, Virus Scanners,
and any other use where shoving the email through an
external application would be useful.

Ideally I'd love to have a "Bayesian Classifier" filter
that periodically goes through my folders and creates
profiles based on emails in each folder.  Then I shove
the incoming mail through the filter and and have it 
tell the sieve script where to file the email.  However 
I can't get around needing a return variable from the 
script, or at least a regular expression matcher that 
could extract the chosen folder from a header the 
classifier inserted into the email.  I could do a huge
elsif header :contains "Bates-Class" "<foldername>"
block, but then I need to update the sieve script every 
time I create/delete a folder like I do now every time
I join a mailing list.

Any feedback would be appreciated pro/con/flame/other.

-- Michael --

More information about the Info-cyrus mailing list