PD: I use X-Mailing-List header in the recipe, but that´s
something I would like people comment on. Maybe Resent-From ?
I'm going to turn this into another procmail mailing list... :)
I've found that X-Mailing-List: doesn't always exist; sometimes
it's From_, Sender:, or Delivered-To: that I end up having to
use. And of course, they all have different formats... In a
special case like that you could have an earlier recipe that
adds an X-Mailing-List: header like this:
:0fhw
* ^Sender: owner-arid_gardener(_at_)ag(_dot_)Arizona(_dot_)EDU
* ! ^X-Mailing-List:
| formail -A"X-Mailing-List: arid-gardener"
:0:
* ^(X-Mailing-List: \/(.+))
* !^Subject:.*Digest
| (umask 022; export list=`expr "$MATCH" : "\(.*\)@"`; \
test -d $dir/$list || mkdir $dir/$list; \
test -d $dir/$list/$t || mkdir $dir/$list/$t; \
mhonarc -add -quiet -rcfile /tmp/test.rc \
-outdir $dir/$list/$t -umask 022; \
reindex $list $t)
A trick that I use that's worked pretty well is locking
based on the value of the list. That way I can process
multiple messages at the same time, so long as they don't
go to the same directory:
:0
* ^(X-Mailing-List: \/(.+))
* ! ^Subject:.*Digest
{ LISTNAME = $MATCH }
:0: $LISTNAME.lock
* ! LISTNAME ?? ^^^^
| (umask 022; export list=`expr "$LISTNAME" : "\(.*\)@"`; \
test -d $dir/$list || mkdir $dir/$list; \
test -d $dir/$list/$t || mkdir $dir/$list/$t; \
mhonarc -add -nolock -quiet -rcfile /tmp/test.rc \
-outdir $dir/$list/$t -umask 022; \
reindex $list $t)
So this sets the list name in $LISTNAME, then feeds it to
MHonArc if LISTNAME isn't equal to nothing. A lockfile is
created in the form 'LISTNAME.lock', so you're not using a
global lock AND you can remove mhonarc's locking feature.
This is from memory/scratch, so no guarantees. :)
Chris