Going from the setup at http://www.cis.hut.fi/kaip/mail/procmailrc I
decided to go one step further. I couldn't use $MATCH with lists that
have Sender: set to *-owner@ or *-admin@, so I used Perl. Any tips?
% tail -7 .procmailrc
:0h
MAILING_LIST_NAME=|~/.procmail/get_mailing_list_name.pl
:0:
* $MAILING_LIST_NAME ?? ^[a-z]+
| formail -A"X-Sorted: mailing list $MAILING_LIST_NAME" >>
list-$MAILING_LIST_NAME
% cat ~/.procmail/get_mailing_list_name.pl
#!/usr/bin/perl -wT
use strict;
while (<>) {
last if /^$/;
chomp;
if (/^Delivered-To: mailing list ([^(_at_)]*)@(.*)/ or
/^Sender: (.*)-(?:owner|admin)@(.*)/ or
/^Sender: owner-([^(_at_)]*)@(.*)/) {
my ($list_source, $list_name) = ($2,$1);
$list_source =~ tr/A-Z/a-z/; $list_source =~ s/[^a-z0-9]/_/g;
$list_name =~ tr/A-Z/a-z/; $list_name =~ s/[^a-z0-9]/_/g;
print "$list_source-$list_name\n";
last;
}
}
--
Brad Forschinger <bnjf(_at_)optusnet(_dot_)com(_dot_)au>
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail