Procmail help?
Michael R. Head
burner at suppressingfire.org
Tue Jul 3 19:37:48 UTC 2007
On Tue, 2007-07-03 at 14:13 -0500, Scott Lockwood wrote:
> Lol, yes, exactly. Basically, I want to be down to ONE rule per 'topic'
> rather than one rule per list. All the 'Ubuntu' related mail goes --->
> Here, all the Slackware related mail goes ---> there, etc.
I have a fairly complex mailing list config that puts mail from each
list into a folder like so:
ubuntu/ubuntu-users
ubuntu/sounder
gnome/gtk-devel-list
gnome/desktop-devel-list
It wouldn't be hard to change the rules so that all the ubuntu stuff
collapses into ubuntu/ and the gnome stuff into gnome/
Here's the ruleset (note that I use maildir, so if you deliver to
mboxes, you'll need to tweak that, too):
:0
* ^From:.*\/[^< ]*@([^\. @]*\.)*[^\. @>]*
{ FROMADDR=$MATCH }
:0
* FROMADDR ?? ^\/[^@\.]*
{ FROMUSER=$MATCH }
:0
* FROMADDR ?? @\/[^@]*$
{ FROMDOMAIN=$MATCH }
:0
* FROMDOMAIN ?? ^([^\.]*(\.))*\/[^\.]*(\.)?[^\.]*$
{ FROMBIT=$MATCH }
:0
* FROMBIT ?? ^\/[^\.]*
{ FROMNAME=$MATCH }
:0
* FROMADDR ?? @\/[^\.@>]*
{ FROMHOSTNAME=$MATCH }
:0
* ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>]*))
{
LISTID=$MATCH
:0
* LISTID ?? ^\/[^@\.]*
{ LISTNAME=$MATCH }
:0
* LISTID ?? .*\/[^@\.]*(@|\.)[^@\.]*$
{ SERVERNAME=$MATCH }
:0
* ^List-Id:.*lists.sourceforge.net.*
* LISTID ?? ^\/[^-\.]*
{ DIRNAME=$MATCH }
:0
* ! ^List-Id:.*lists.sourceforge.net.*
* SERVERNAME ?? ^\/[^\.]*
{ DIRNAME=$MATCH }
:0
* LISTID ?? (apache.org|codehaus.org)$
* LISTID ?? (\.|@)\/[^\.]*
{ LISTNAME=$MATCH-$LISTNAME }
# * LISTID ?? @[^\.]*\.\/[^\.]*
# :0Wic
# * ? test ! -e $MAILDIR/$DIRNAME
# | mkdir $MAILDIR/$DIRNAME
:0
".$DIRNAME.$LISTNAME/"
}
:0
* ^(X-Mailing-List:|Delivered-To: mailing list|List-Id:)[ ]*
\/[^ ].*
{
LISTID=$MATCH
:0
* LISTID ?? ^\/[^@\.]*
{ LISTNAME=$MATCH }
:0
* ^Delivered-To: mailing list [^@]*@icculus.org
* LISTID ?? ^\/[^-@\.]*
{ DIRNAME=$MATCH }
:0
* ! ^Delivered-To: mailing list [^@]*@icculus.org
* LISTID ?? .*\/[^@\.]*(@|\.)[^@\.]*$
{
SERVERNAME=$MATCH
:0
* LISTID ?? (apache.org|codehaus.org)$
* LISTID ?? (@|\.)\/[^\.]*
{
LISTGROUP=$MATCH
:0
* LISTID ?? ^\/[^@\.]*
{ LISTNAME=$LISTGROUP-$MATCH }
}
:0
* SERVERNAME ?? ^\/[^\.]*
{ DIRNAME=$MATCH }
}
# :0Wic
# * ? test ! -e $MAILDIR/$DIRNAME
# | mkdir $MAILDIR/$DIRNAME
:0
".$DIRNAME.$LISTNAME/"
}
> On Tue, 2007-07-03 at 12:00 -0600, telecon at infosyndicate.net wrote:
> > On Sat, Jun 16, 2007 at 12:34:27PM -0500, Scott Lockwood wrote:
> > > I'd like to pair down my .procmailrc some, so I tried to make a rule for
> > > list traffic based on the List-Id header, rather than having to have one
> > > for the To header, and one for the Cc header. This doesn't seem to work,
> > > however. Anyone have a rule already they care share that works on the
> > > List-Id line in the header?
> >
> > Are you trying to have one recipe to rule them all?
> >
> > Them being the mailing lists. You'd have to extract the list id using shell
> > or formail magic, then forge that back in to your destination folder.
> >
> > It could get ugly, but should be doable.
> --
> Regards,
> Scott Lockwood
>
>
--
Michael R. Head <burner at suppressingfire.org>
http://www.suppressingfire.org/~burner/
http://suppressingfire.livejournal.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070703/de644c43/attachment.bin>
More information about the ubuntu-users
mailing list