On Sat, Nov 10, 2012 at 10:37:04PM +0000, Tony's unattended mail wrote:
> > However, I find dovecot deliver (which uses the sieve language 
> > for filtering) to be much more readable/writable than procmail.
> 
> Sieve does not include regular expressions -- I shit you not.
> 
> Dovecote needs regular expression capability to be shoe-horned in by
> some hokey plugin.  Regular expressions are quite fundamental to a
> mail filtering language that has an appropriate amount of expressive
> power.  It's bizarre that sieve is presented as a thought out
> successor to procmail complete with an RFC, and yet it excludes
> something as essential as regular expressions.
> 
> I'm resisting sieve because the C-style makes the code look cluttered,
> and it lacks expressive power.  The one aspect that may compel a
> switch to sieve is the fact that it is MIME-aware.  MIME predates
> procmail, and it's a shame that procmail has become unmaintained.
> 
> OTOH, I might rather have third party tools for MIME than third party
> tools for regular expressions.

I simply have a custom script written in Python, hence I have all the RE
and/or other technology I need without much effort.

My filter rules *aren't* written in Python or any language as such, they
are in a format that is as user-friendly (well, me friendly) as possible
and are thus a straight text file with very little special syntax.  The
*program* takes care of that, it's what computers are good at, why
should I faff about with funny characters, layout, etc. when the
computer can do it all for me.

My filter file has the following format:-

    cheddar         Li      cheddar-us...@lists.halon.org.uk
    dabo            Li      dabo-us...@leafe.com                    dabo-users
    dbacruising     Li      dbacruis...@lists.shire.net
    dbamain         Li      dbam...@lists.shire.net
    dbamatters      Li      dbaassociationmatt...@lists.shire.net
    dbasocial       Li      dbasoc...@lists.shire.net
    dia             Li      dia-l...@gnome.org
    digitemp        Li      digit...@googlegroups.com
    dnsmasq         Li      dnsmasq-disc...@lists.thekelleys.org.uk 
Dnsmasq-discuss

Where the first column is both the mutt alias for the list *and* the
directory (under Li) where the incoming list mail is stored.  The second
column is a destination directory (some things get directed to a Ju -
junk - hierarchy).  The third column is a string to match in either To:
or Cc:. The fourth (optional) column is a string to remove from the
subject line if found between [].

My Python script to implement all this is only a 100 lines or so of code
in total.

When I subscribe to a new mailing list I just add the appropriate line
to the above filter file and that's it, nothing else to do at all.  A
couple of very simple scripts get what's needed from the file to provide
(as I said) a mutt alias for the list and to add the list to provide
what is needed for mutt 'lists', 'subscribe' and 'mailboxes'.

... and as I was saying the filter file itself is in an incredibly
simple format, no XML, no indenting, no block structure, no funny
characters required.  About the only 'special' thing is that you can add
comments by having lines starting with a #.


-- 
Chris Green

Reply via email to