On 11-Nov-2007, at 03:07, Stefano Sabatini wrote:
# MAILING LIST MANAGING
# all messages directed to some mailing list are immediately put
# in a corresponding folder
AUTO_RC = mailing-lists-rc
:0
* $ ? print-mailing-lists-rc.pl ~/etc/mailing-lists > $AUTO_RC
{ INCLUDERC = $AUTO_RC }
no need to go to an external script. This works nearly (some lists
have failed, but it's been a long time since I had a list fail to
match) perfectly:
[ ] is a space and tab
MYDATE=`date '+%Y-%m'`
LISTNAME
# Sean wrote this
:0
* 9876543210^0 ^(List-Post:[ ]*(<mailto:)?|List-Owner:[
]*(<mailto:)?owner-)
\/[-A-Z0-9_+]+
* 9876543210^0 ^(List-Id:.*<|X-Mailing-List:[ ]*)\/[-A-z0-9_+]+
* 9876543210^0 ^(Sender:[ ]*owner-|X-BeenThere:[ ]*|Delivered-
To:[ ]*mailing list )\/[-A-Za-z0-9_+]+
* 9876543210^0 ^Sender:.* List"? <(mailto:)?\/[-A-Z0-9_+]+
{ LISTNAME=$MATCH }
VERBOSE=ON
# OK, that didn't work, let's try List-Subscribe
:0E
* ^List-Subscribe:.*<mailto:\/[-A-Z0-9_+]+-(digest|on|subscribe)@
* MATCH ?? ^^\/.+-
* MATCH ?? ^^\/.+[^-]
{ LISTNAME = $MATCH }
VERBOSE=OFF
# Save all list messages into a directory named for the
# list and then date stamped by month. Uncomment ^# lines
# for maildir and comment out the mbox lines
:0
* ! LISTNAME ?? ^^^^
{
# Add a listname header
:0fw
| formail -i "X-mydomain-Listname: $LISTNAME"
:0: $HOME/lock
$LISTNAME/$MYDATE.$LISTNAME
# .$LISTNAME.$MYDATE/
# if the action failed, probably the directory does not
# exist, so create it
:0eW
{
LOG="FAILED WRITE$NL"
MAKENEWDIR=`test -d $MLDIR/$LISTNAME || mkdir -p $MLDIR/
$LISTNAME/`
# MAKENEWDIR=`test -d .$LISTNAME || maildirmake .$LISTNAME`
}
# Now save the message again
:0a:
$LISTNAME/$MYDATE.$LISTNAME
# .$LISTNAME.$MYDATE/
# Still failed? Better save the message somewhere we can check it
:0
{
LOG="FAILED WRITE NEW DIRECTORY$NL"
:0: $HOME/lock
FAILED_LIST_SORT
# .FAILED_LIST_SORT/
}
}
I have about 20 lists that come into this recipe and are processed.
When I subscribe to a new list, it all. just. works.
/home/kremels/Mail/procmail:
2007-01.procmail
2007-02.procmail
2007-03.procmail
2007-04.procmail
2007-05.procmail
2007-06.procmail
2007-07.procmail
2007-08.procmail
2007-09.procmail
2007-10.procmail
2007-11.procmail
(older email gets archived elsewhere)
--
Hey, how come Andrew gets to get up? If he gets up, we'll all get up,
it'll be anarchy.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail