I use sieve as part of my home-brew spam filter setup, but I hate it. The syntax is atrocious and the documentation is abysmal. The only way I was able to get my setup to work was by copying examples I found on the web and incrementally tweaking them by trial and error until they did the right thing. It took days and the end result was only about a dozen lines of code.
How hard could it be to design a sane mail filtering language? I guess I'll just have to take that on one of these days.
Iff you like Python, then mailprocessing¹ is a nice solution for this. You just write a small Python script to implement your rules:
for mail in processor:
if mail['X-Bugzilla-URL'].contains('zephyr-ds'):
mail.move('Zephyr')
elif ...
Given the layer it operates on you don't need to worry quite so much about processing errors dropping mails either.How well does it handle non-ascii character sets or non-compliance emails? I haven't been able to find a mail processing library that gracefully supports something like Arabic characters in the headers/body and also does not include a content-encoding header.
In the specific case of Arabic characters in headers, you can see from the source¹ that when decoding fails an error is logged but you're still able to work on that header. How much work you're willing to put in to recover from that error by guessing charsets(perhaps via chardet²) is up to you.
The level of customisation that is possible is my favourite feature of this type of software. You can start with a config that is just a couple of lines, but it grows with you with no artificial ceiling imposed by the software author's imagination.
¹ https://github.com/mailprocessing/mailprocessing/blob/master...