develooper Front page | perl.bootstrap | Postings from August 2000

A procmail rule to filter messages.

Thread Next
Jacob Davies
August 16, 2000 14:20
A procmail rule to filter messages.
Message ID:

I got tired of adding a procmail rule for each new mailing list,
so I made a procmail rule that can automatically filter them.

Here's what I came up with for a first pass at it:

	* ^X-Mailing-List: contact \/(.*)-help

assuming your mail goes into $HOME/Mail in Berkeley mailbox format.  I'm no
procmail wizard, but this works for me.  Unfortunately it also names
the mailboxes "bootstrap-help", "perl6-language-help" etc.  The procmail \/
regex marker and $MATCH only seem to be able to break off the right hand
side of a matched expression, there's no equivalent of $1 that I could see.

This has the disadvantage that if you subscribe to mailing lists
that send an X-Mailing-List: header that looks like the ones, those
will start getting filtered too.  You could change the match to:

	* ^X-Mailing-List: contact \/(.*)

but then all the filenames would have on the end.

If someone has a finer-tuned rule than this, excellent, send it on in!

I deal with having magically-appearing mailboxes with Mutt by having a line
like this:

	mailboxes ! mbox `echo Mail/*`

in my .muttrc, so that new mailing lists show up without my having to add
them by hand.

Jacob Davies

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About