[svlug] procmail (was: Some pretty serious parsing)

Ivan Sergio Borgonovo mail at webthatworks.it
Mon Nov 16 16:36:32 PST 2015


On 11/17/2015 12:10 AM, Akkana Peck wrote:
> I will take a look at sieve and see how much work it would be to
> rewrite all my existing rules. Thanks for the recommendation.

If you're just filtering on headers (subject, from, to) without any side 
effect and no nested or complicated logical conditions you could simply 
write a sed program to help you translate the rules and finish the work 
by hand.

sieve is much more specialized in email filtering than procmail, that 
translates in less flexibility (or flexibility at a cost) but much 
greater readability and maintainability.

At the beginning I was skeptic, I didn't want to miss flexibility and I 
didn't like the idea to learn something new to do something old that 
somehow was working.

But it took much less time to translate my recipes than what I 
thought[1] and now I've no fear to touch my sieve scripts because they 
are very easy to read and edit, I can check them before I put them in 
production and the chances I really miss emails are much lower since 
unless you explicitly tell to delete email everything end up in INBOX.

It is much easier to maintain "global" and per users scripts and provide 
users with "facilities" to help them filter their emails and there are a 
lot of tools with GUI to write and check rules (even remotely with 
managesieve).
dovecot sieve offers also a dry-run mode I never used since rules are so 
simple and error reporting so clean and unrecoverable errors so hard to 
make I never felt the need to dry-run my rules.

When you're coming from procmail it doesn't look such a big improvement, 
but it is.

Even the fact I rarely update my filters doesn't scare me since rules 
are so clear I don't have to remember how to edit them and I love tools 
that leave my memory free for the tools I don't love ;)


[1] http://wiki.dovecot.org/LDA/Sieve
there is a link to a tool I remember I've downloaded but I didn't use. 
Probably because I don't like perl so I'm not fluent reading it, 
probably because my procmail rules were generated from a script.
I think everything ended up in loading my scripts in vi, using a bit of 
search&replace and doing some manual edit, just because writing a 
program was not really worth it and the new syntax gave me some space 
for making everything tidier.

My current sieve scripts are around 400 lines long, mostly consisting of 
list of addresses or list-ids.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it




More information about the svlug mailing list