Quick Mail Filtering

Lately I’ve been busy getting my mailboxes cleaned up. One of the most important things to process mails quickly is filtering. Since I read my mail from different computers at work and at home I am mostly depending on sieve-based serverside filters. Those are either edited in a web-based gui or as textfiles. On my private mail account the admins were nice and installed websieve which allows to switch to full text editing without using the noob-gui. Thanks.

At work we have smartsieve. You cannot turn off the gui. Which means: I would have to edit every single rule with a web form … not good. Today I found a little tool called sieveshell which allows easy uploading and activating of textfiles as sievescripts. Just install sieveshell (comes with the cyrus-admin-xyz package in ubuntu), write your mailfilter and your nearly done:

sieveshell --user=youruser --authuser=youruser --execfile=sieve-commandos.txt your.server.address

The file sieve-commandos.txt contains just 2 lines, I need this one for further automation so I do not have to use the shell interactively.

put myfilters.siv
activate myfilters.siv

Finally I made a bash alias for the commando and now I can easily upload my mailfilters anytime … I keep the file open in my editor of choice (if yours is emacs, emacs has a built-in sieve-upload thingy – but then you can probably cook coffee with emacs as well). By the way: if you upload a script that has syntax errors the server will tell you! So if it stays quiet everything is fine 😉

This was the only option (emacs does not count) I found to upload filters to the server without use of some web-gui. It’s not so bad if you have websieve but with smartsieve I found no way to just write some text …

By Yashima

Writer of code and stories