maddy
maddy copied to clipboard
Sieve filters support
https://tools.ietf.org/html/rfc5228
Having ManageSieve protocol too would be nice: https://tools.ietf.org/html/rfc5804
Also, found Sieve lang parser for golang: https://github.com/qingshan/sieve. I wonder if it works...
Once sieve filtering has been added, is the possibility of having a [email protected] email that gets emails forwarded into spam folder a reality?
Yes.
Sieve support would be cool. Can't imagine any Imap service without Sieve.
When building WildDuck Mail Server we decided to not use Sieve and instead went with custom filtering system that is applied to incoming emails and is easy to integrate with a web UI. Basically these are If-This-Then-That rules (example). Such filters cover 90% of use cases required by users.
We did not see any value in actual Sieve mostly because it's a separate programming language (so there might be some security issues if a user is able to come up with a complex enough script). Also most users are not able to write it anyway, so usually it ends up being disguised by the UI into simpler forms.
Sieve has a great upside: it's a standard. So it really helps users switching from an email server to another without having to learn a new filtering DSL and convert all of their filters.
Additionally, Sieve is not Turing-complete (no loops, no functions), so I wouldn't be too worried about complex scripts.
@angelnu idea for a solution
-
Implement ManageSieve in Maddy so users can use their email clients to upload the filter configs to the server this could be either be implemented natively in Go or call existing (but old) Python libraries . The protocol looks simple enough so re-implementing in Go might even be easier so we could reuse the STARTTLS support in Maddy.
-
Add a Sieve parser to Maddy to process the uploaded scripts and generate the scripts out of the sieve configs. Here we could use the C library libsieve as re-implementing in Go might be more work.
I implemented a simple interpreter for the base Sieve specification here: https://github.com/foxcpp/go-sieve.
Once we get support for several important extensions into it and find a way to re-use Pigeonhole tests suite - it should be ready for integration into maddy. Though we will need a several rounds of refactoring to make IMAPFilter interface flexible enough.