Mail filtering.

David Woodhouse dwmw2 at infradead.org
Mon Sep 11 11:55:43 EDT 2006


For the benefit of those who _were_ filtering on the subject line, a
word about mail filtering.

The most reliable way to filter out traffic which actually came from the
mailing list is to look at the address it's coming from -- the
'reverse-path' used in the SMTP transport over the network; the address
to which bounces go if the mail can't be delivered. For the olpc-devel
list, that will be devel-bounces at laptop.org.

With a capable MTA like Exim, you can just filter on that directly --
the relevant lines of my mail filter look like this:

	if "$sender_address" matches "devel-bounces.*@laptop.org" then
	        save Maildir/.lists.olpc-dev/
	        finish
	endif

Even if your mail software isn't capable enough to filter on the sender
address directly, you can still do it -- you should normally find the
reverse-path in a 'Return-Path:' header, which is added by the mail
software as it's actually delivered into your mailbox. Or if you're
using mbox-format mail folders, then the reverse-path should be on the
'From ' line which servers as the delimiter between messages. You should
be able to filter on either of those -- a procmail (ick) example would
be as follows:

	:0:
	* ^Return-Path:.*devel-bounces.*@laptop.org
	$HOME/Maildir/.lists.olpc-dev/

By filtering on that information, you should catch all list traffic and
only list traffic. If someone chooses to reply to you _personally_,
you'll get that in your inbox. If you're busy with other things and
ignoring the list, but someone sees something that you should pay
attention to and redirects a mail to you personally, then that'll land
in your inbox too. Likewise if you've unsubscribed from the list but not
bothered to change your mail filtering, and someone redirects the mail
to you.

Using List-Id, you'll miss the mail which was bounced to you personally
after going through the list -- it would get a false positive and _also_
go into the list folder. If you don't think that situation would ever
happen, or if you don't care about the mail being misfiled, then perhaps
you could get away with filtering on the List-Id: header. 

You may also see false negatives with List-Id: if mail comes through
more than one list (i.e. one list is subscribed to another, or someone
redirects a mail from one list to another). If the software running the
second list doesn't actually _replace_ the List-Id: which was added by
the first, then it may not trigger the filter on List-Id:. The
reverse-path filter would correctly catch it, of course.

If you're using the Subject: header, then the filter is going to get
false positives even on private mail which arose out of list traffic and
hence still has the [silly-list-noise] tag in its Subject: header. And
if you're subscribed to two mailing lists and the topic is cross-posted
then it'll also not reach the correct folders.

-- 
dwmw2




More information about the Devel mailing list