On Fri, Apr 19, 2002 at 11:48:45PM -0600, Rob 'Feztaa' Park wrote: > Ok, I've spent the better part of this evening searching google, the > procmail website, and mutt archives, but I just can't find how to do > this. I'm sure I've seen somebody post it here once, but I can't find > it.
Just a few days ago, I tried to do this very thing, using Alan Stebbens'
procmail library, which manifests in the Debian archive as procmail-lib.
It contains list-addr.rc which -almost- did the trick for me.
[ The barrier being that this stanza was matching but not setting
anything useful for me:
:0 H
* $\/${USERADDR}-request@$HOSTADDR
{ LISTADDR=$MATCH }
for the lists that I was testing it with. ]
[ Snip. ]
> I know I could do something like this (untested):
>
> :0:
> * ^TO_\/.*@qux\.com
> ~/mail/$MATCH
>
> But, the problem being that the foldernames would be the actual address
> of the list ('[EMAIL PROTECTED]' instead of 'foo', which is what I really
> want).
>
> Any ideas? Thanks.
Here's what I ended up doing as a holding action until I can get back
to list-addr.rc and sort out the matching issue there.
# Find a list
:0 H
* ^(List-Id|X-(Mailing-)?List):.*<\/[^>]*
{ # Yup, it's a list.
:0
# Is it debian-foo? Put it in the Debian/foo folder
* MATCH ?? ^debian-\/[a-z]+
$MAILDIR/Debian/$MATCH/
:0 E
# It's some other kind of list, do something smart with it.
. . .
}
This might hold you until someone else provides you with a smart answer.
It's effectively two successive matches, looking for criteria that
demonstrate that it's a list, and then matching only the part that
will give me a folder name, the [a-z]+ that follows the list-prefix.
In your example case, it would seem to be even shorter, once you know
it's a list, just test MATCH against [a-z]+ and grab the word-before-@.
> --
> Rob 'Feztaa' Park
> [EMAIL PROTECTED]
> --
> A nickel ain't worth a dime anymore.
> -- Yogi Berra
--Shannon
msg27483/pgp00000.pgp
Description: PGP signature
