1 message in net.sourceforge.lists.courier-maildrop[maildropl] Matching valid characters...
FromSent OnAttachments
Robin BowesApr 16, 2003 12:23 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[maildropl] Matching valid characters in local part of email addressActions...
From:Robin Bowes (robi@robinbowes.com)
Date:Apr 16, 2003 12:23:45 am
List:net.sourceforge.lists.courier-maildrop

Hi,

Firstly, let me apologise for the previous couple of messages that "sneaked" out lastnight. This is the final version.

I'm using maildrop with qmail/vpopmail/courier-imap

I'm auto-creating mailing list folders uding a modified version the code posted by Robert Fleming/William Pietri.

This is the original snippet of code:

if ( /^List-Id:.*<![:alnum:]*\-?[:alnum:]*\-?[:alnum:]*\-?[:alnum:]*!.*>/ || /^X-list: ![:alnum:]*/ || /^Mailing-List: contact ![:alnum:]*\-?[:alnum:]*!-help@.*/ || /^Mailing-List: list ![:alnum:]*\-?[:alnum:]*!@.*/ || /^Sender: owner\-![:alnum:]*\-[:alnum:]*!@cyrusoft.com/ || /^List-Post: <mailto:![:alnum:]*/) { exception { to .${LISTS_FOLDER}.${MATCH2}/ } }

The problem with this is that [:alnum:] is the same as [0-9A-Zz-z], but the local part of the e-mail address can include quite a few other characters. Hence the rather awkward constructs used in the above clause, e.g. [:alnum:]*\-?[:alnum:]*\-?[:alnum:]*\-?[:alnum:]*

What would be useful would be another shorthand notation which represents all valid characters for the local part of an e-mail address, e.g. [:validlocal:].

I'm currently using [0-9A-Za-z_\-], which matches any alpha-numeric characters plus "-" and "_". These seems to be sufficient for most mailing lists I've come across.

Here's the "if (...)" clause I'm currently using:

if ( /^List-Id:.*<![0-9A-Za-z_\-]*!/ || /^X-list: ![0-9A-Za-z_\-]*!/ || /^Mailing-List: contact ![0-9A-Za-z_\-]*!-help@.*/ || /^Mailing-List: list ![0-9A-Za-z_\-]*!@.*/ || /^Sender: owner\-![0-9A-Za-z_\-]*!@cyrusoft.com/ || /^List-Post: <mailto:![0-9A-Za-z_\-]*/ || /^List-Subscribe: <mailto:![0-9A-Za-z_\-]*!-subscribe@.*/ || /^Return-Path: <owner-![0-9A-Za-z_\-]*!@.*>/ ) { exception { to .${LISTS_FOLDER}.${MATCH2}/ } }

I've added a couple of additional patterns: 1. to catch ezmlm lists (List-Subscribe:) 2. to catch an old list I subscribe to that doesn't seem to produce any sort of Mailing list headers except Return-Path: which is in the form "Return-Path: <owner-listname@host.domain>"

Note that the if ( ...) clause should be entered all on one line, with no spaces between the brackets.

Also, I couldn't get filtering on Return-Path to work unless I used the following invocation of maildrop in my .qmail-default file:

| preline -f /usr/bin/maildrop mailfilter

I'll try and write up the whole approach and stick it up on my web site sometime soon.

R.