Bill writes about the usefulness of list header metadata, so I thought I'd put up the procmail recipies I use to catch mailing list emails.
# Yahoo Groups
# (e.g. Mailing-List: list mt-dev@yahoogroups.com)
:0:
* ^Mailing-List: list \/[^@]+
lists/$MATCH
# Mailman and other intelligent software lists
# (e.g. List-Post: <mailto:Pluginmanager-l@rayners.org>)
:0:
* ^List-Post: \<mailto:\/[^@]+
lists/$MATCH
# Other list software?
# (e.g. X-Mailing-List: <ftjava-test@firedrake.org>)
:0:
* ^X-Mailing-List: \<\/[^@]+
lists/$MATCH
# Mojo Lists
# (e.g. List: lug)
:0:
* ^List-Software: Mojo Mail
* ^List: \/[^@]+
lists/$MATCH
# ListProc (all those UMBC lists)
# (e.g. Sender: owner-umbclinux@listproc.umbc.edu)
:0:
* ^Sender: owner-\/[^@]+
lists/$MATCH
# More lists (realms-l)
# (e.g. From owner-realms-l@ORACLE.WIZARDS.COM)
:0:
* ^From owner-\/[^@]+
lists/$MATCH
Most of the mailing list software out there adds the headers and I can catch them relatively easily. With others, however, I have to do a little digging. And the realms-l list drives me insane. Here's how it identifies itself within the email:
Sender: The Forgotten Realms Mailing List <REALMS-L@ORACLE.WIZARDS.COM>
I suppose I could look for that specifically, but that's exactly the point. I shouldn't have to write filters for specific mailing lists. It defeats the whole purpose of putting the list data in the email headers.
Anyways, for all you procmail/regexp experts out there, how do you think I could handle this odd case:
Sender: port-sgimips-owner@NetBSD.org
Procmail's match operator can't pick out the stuff between "Sender: " and "-owner". I'd use the simple "^Sender: \/port-sgimips". That works, though is definitely suboptimal because you must make a recipe for each such list. To automatically catch new lists you could add a catch-all recipe which matches "^Sender: \/.*-owner" - so while new lists would have "-owner" in the filename, at least the traffic would be caught and put into a file specifically for that list.
:0:
* ^Sender: \/[^@]+
lists/`echo $MATCH | sed -e 's/-owner//'`