Exporting kmail filters

2007-12-23 (permalink tags: , , , )

I love emails. Emails can be threaded into conversations, sent to multiple recipients, contain attachments, and be archived into folders for easy retrieval. Emails are scriptable. You can setup filters that will classify them according to complex criteria, put them into folders, call scripts to trigger events, pipe them through commands, or simply delete them.

I use kmail. It has a great filter system with a visual regular expression editor and filters can be bound to toolbar icon or to keyboard shortcuts. But kmail has a really poor filter export facility. I can understand why it's hard to export them: filters are not just action units; they are part of a pipeline and many of my filters are completely meaning less if they are not executed in a very specific order. Nevertheless, I have a set of non-trivial filters at work that I want to keep in sync with my filters at home.

Kmail hides its filters in kmailrc, a .ini file a lot a auto generated noise. At first, I tried to copy all the [Filter XX] blocks from one kmailrc to the other but there is a really big problem with this solution: it seems to work. Some of the filters will indeed get imported but if you end up with more filters than you previously had, the last few filters in your pipeline will silently get discarded. For some reason, kmail can't figure out how many filters you have so it keeps the count in the [General] section of the kmailrc. I don't want to count my filters each time I synchronize them so I wrote a convenient script to take care of that. Enjoy!

Comments

2009-10-28 01:27:04 by mohammed (direct link | reply)

Good one. Do you know if it's possible to export kmail filters to thunderbird or evolution? I looks like they are storing filters in different ways.

Thanks, Mohammed.

2011-08-03 13:58:34 by Fred (direct link | reply)

Thanks for this article. This helped me out !

Leave a comment