On 13May2012 18:23, Jim Graham <[email protected]> wrote:
| On Mon, May 14, 2012 at 09:03:00AM +1000, Cameron Simpson wrote:
| > On 13May2012 06:21, Jim Graham <[email protected]> wrote:
| > | OB Mutt:  I use fcc-hook frequently to store related groups of e-mail.
| 
| > I do this in my mail filters. That way if I need to I can refile a
| > message without composing an email; just copy/move it to the right spool
| > folder. My setup goes:
| > 
| >   cron runs getmail regularly, delivers to "spool"
| >   once a second, my filtering program polls spool-in (divert spam, the rest
| >     to "spool"), spool (filter inbound email to various folders), spool-out
| >     (file outdound email - this is $record), spool-xref (cross file
| >     messages)
| 
| Here's my setup:
| 
|    cron runs fetchmail --all every even numbered minute at 0 seconds
|    fetchmail hands all incoming e-mail to procmail, which is the MDA
|    procmail looks through ~/.procmailrc (and included files) for a
|       matching rule.  Whitelisted addresses are matched first, to
|       avoid false positives.  Know/frequent spammer addresses are
|       caught in a filter file called ~/.procmail/defspam, and go
|       straight to /dev/null.  All others face The Gauntlet....
|       Survivors go to /var/spool/jim OR to a file for its list in
|       `/incoming.mail (e.g., mutt-users, android-developers, etc.).
| 
| > Most rules are one liners:
| >   folder tag  pattern
| 
| Procmail rules are also quite simple---here are a couple of examples:
| 
| :0:
| * ^(From|To|CC).*([email protected]|amazon.com|spamsite)
| /dev/null

And yet, too painful. I started with procmail, then wrote
cats2procmailrc:

  http://freecode.com/projects/cats2procmailrc
  http://cskk.ezoshosting.com/cs/css/manuals/cats2procmailrc.1.html

which writes procmail rules from rules of the style I outlined above.
It has a hook syntax to embed raw procmail syntax when a special rule is
needed.

So, with cats2procmailrc a new procmailrc is then just a "make" away.
With over 1000 rules I found procmail in the raw just too painful and
cumbersome.

And the regexp based matching grated on my nerves; it is just not
reliable, and compute expensive (especially when procmail has to read
and compile all the regexps for each arriving email). Ok for the regular
email, but awful when you have a huge batch (eg you've been offline for
a week and need to suck down thousands of messages).

My current mailfiler parses these rules directly, and I've cleaned up
their syntax slightly. For example, the (GROUP|GROUP|...) syntax for
crossfiling rules was a HUGE computed regexp made from all the mail
addresses in those groups in procmail. Sufficiently huge to need
"LINEBUF=131072" in the procmail config.

And maintenance is easier. Observe:

  [~]janus*> grep mutt ~/rc/mail/filer/spool-in 
  !me,mutt Mutt-Announce   [email protected]
  mutt     Mutt-Dev        sender:[email protected]
  mutt     Mutt-Users      [email protected]
  mutt     Mutt-Users      [email protected]@korn.aiss.de
  mutt     Mutt-Users      [email protected]
  mutt     Mutt-Users      sender:[email protected]
  mutt     c.m.mutt        comp.mail.mutt@usenet
  mutt    offline-imap     [email protected]
  mutt    offline-imap     
sender:offlineimap-project-bounces+cs=zip.com...@lists.alioth.debian.org
  |mailundigest mail       [email protected]
  mutt    comp.mail.mutt   comp.mail.mutt@usenet

In procmail speak that's quite a maintenance burden, especially when you
include actions to log or to add labels. Here's an example rule:

  spam   SPAMMER from:[email protected]

and the procmail code I generated:

  # /home/cameron/mail/spool/.cats2procmailrc: < cats/spammers
  # cats/spammers: =spam   SPAMMER from:[email protected]
  :0
  * ^from:.*\<([email protected])\>
  {
    LOG=`datecode`" "`email-summary-line 2>&1 || :`
    :0whf
    | formail -f -A 'X-Cats2Procmailrc-Rule: cats/spammers: =spam
  SPAMMER from:[email protected]'
    :0whf
    | formail -f -A 'X-Label: SPAMMER'
    :0
    /home/cameron/mail/spam/
  }

A log line, two header lines added, then a filing. Bulky. And of course I
wanted that degree of activity for every rule...

Cheers,
-- 
Cameron Simpson <[email protected]> DoD#743
http://www.cskk.ezoshosting.com/cs/

...In 1988, Richard Berry, [composer of the song `Louie Louie'], finally
confirmed there is no comma in the song's title, laying to rest a question
that had baffled copy editors for three decades.
        - Greil Marcus, MYSTERY TRAIN

Reply via email to