When we want to create a script sieve, we need to know Sieve language, and we don’t use all days this language so it’s easier to create typo and error.

So I decided for 4.11 to create an assistant to generate sieve code.

By default end user prefers to use GUI to create filters (as sieve script is using for filter mainly). In KMail filter GUI is good. So I decided to use same interface.

This interface is separate in 2 elements:

  • List of scripts: we can add several scripts
  • And a second element which show conditions and actions.

I tried to add all sieves specifications and some sieve extension.

It supports default sieve specification:


  • fileinto (move mails to specific folder)
  • discards (discards emails)
  • keep (keep emails here and stop action)
  • add flags/remove flags/set flags (add/remove/set flags)
  • redirect (forward emails)
  • reject (reject emails)
  • stop (stop script execution)


  • size (test on email size)
  • address (test address)
  • header (test headers)
  • envelope (test envelope of mails)
  • exists (test if headers exists)

But sieve has some extensions, I tried to add them, I didn’t implement all of them because we can’t add them in GUI easily.

I added:


  • Body extension (test body)
  • Date, test date in header  ( for example receiver header)
  • CurrentDate, test on current date
  • MailboxExist, test if specific mailbox exists


  • Delete headers, allows to remove some headers
  • Add headers, allows to add new headers
  • Notify create a notification

But I will not show all extensions when not necessary.

So you will show them when server support them.

After that it will generate for you code :)

I hope that it will help us to use sieve scripts.

I still 3 months to finish and debug it :)


6 comments untill now

  1. Can KMail determine automatically if sieve is supported?

  2. yes of course :)

  3. Awesome! I love it how you’re re-using the KMail filtering GUI for Sieve scripts.

    If there was GHNS integration as well for sharing useful scripts, it’d be just amazing :)

  4. “GHNS integration” why not :)
    I add it to my TODO-list

  5. Laurent: YOU ROCK :D

  6. Very good, thanks! This is much more usable for users than directly editing sieve language!

Add your comment now