Migrating procmail rules to Sieve with a real parser
Summary
In November 2025 Manuel Schmitt rewrote the Procmail to Sieve converter for manitu's web hosting customers as a real parser. The old converter was based on free scripts, including some from the Dovecot ecosystem, and customers reported weak results. The new parser deliberately does not support nested Procmail blocks with curly braces because hardly any regular customer uses them.
Why Procmail rules move to Sieve
Procmail filters mail through recipes made of conditions and actions and can also hand a message to arbitrary programs. Sieve is a dedicated filtering language that RFC 5228 defined as a Proposed Standard in January 2008.
RFC 5228 restricts Sieve on purpose: the base language has no variables, no loops and cannot start external programs. That is exactly why it suits mail servers where users may not run their own programs. Dovecot executes such scripts with the Pigeonhole interpreter.
Ideas
- A parser understands rule structures more reliably than a chain of text substitutions.
- Customer feedback exposed the weaknesses of the old converter.
- Rare nested Procmail blocks deliberately remain outside the supported scope.
- A migration may leave out expert cases if it states these limits clearly.
- Sieve filters inside the mail server without starting external programs.
Insights
- Good converters earn trust through precise limits rather than pretended completeness.
- Old mail filters are executable operational logic and deserve tests like other source code.
- Moving from Procmail to Sieve trades flexibility for a controllable language scope.
Facts
- The previous converter was partly based on free scripts, including prior work from Dovecot.
- RFC 5228 defined Sieve as a Proposed Standard in January 2008.
- The Sieve base language has no variables, no loops and no calls to external programs.
- Dovecot runs Sieve scripts with the Pigeonhole interpreter.
- Procmail 3.24, released in March 2022, is the latest version so far.
References
- Manuel Schmitt on Hostblogger: original article (German)
- RFC 5228: Sieve: An Email Filtering Language (2008)
- Dovecot: Pigeonhole Sieve
Recommendations
- Test converted rules against a representative message corpus.
- Keep the Procmail rules and document every manual Sieve adjustment.
- Rebuild nested Procmail blocks in Sieve yourself before switching.
- Check which recipes pass mail to external programs; Sieve cannot replace that.
Read the original article on Hostblogger
Found a mistake or have something to add? Get in touch.
Links to the original source and the Web Archive open in a new tab.