Computed list of destinations?

R P Herrold <[email protected]> Tue, 8 Sep 2015 13:49:34 -0400 (EDT)
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
On Mon, 7 Sep 2015, Ian Zimmerman wrote:

> Is there any way for procmail to deliver to a computed or dynamically
> determined list of mailboxes or addresses?
> 
> The lack of loops in the procmailrc "language" makes "no" the obvious
> answer, but I thought there might be a trick the assembled experts know.

The absence of explicit loops does not mean you cannot 
'munged' a X header inside an emai, and then send the result 
back into the top of the procmail process by simply re-sending 
to your self, of course

This is a so-called 'forward reference resolution problem.  We 
need not face it, usually, with some planning


I compute the destination folder 'on the fly' for various spam 
sorting

# ------------ general definitions ---------------------
#
SHELL=/bin/bash
#
export MAILDIR=$HOME/mail
export LOGDATE=` date +%d`
export LOGMONTH=` date +%m`
export MONTHROTOR=` echo "0${LOGMONTH} % 3" | bc`
#	the next line actually all one line 
#	without '\' continuation
[ ! -d $MAILDIR/_spam/$MONTHROTOR-$LOGDATE/ ]   && mkdir -p \
	$MAILDIR/_spam/$MONTHROTOR-$LOGDATE/
# ...
:0 Whc: .msgid.lock
        | formail -D 8192 .msgid.cache
:0 a:
        $MAILDIR/_spam/$MONTHROTOR-$LOGDATE/z_duplicates
#
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
        $MAILDIR/_spam/$MONTHROTOR-$LOGDATE/z_almost-certainly-spam
#

# All mail tagged as spam (eg. with a score hig her than the 
#	set threshold) is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
        $MAILDIR/_spam/$MONTHROTOR-$LOGDATE/probably-spam
# LOG="after procmailrc spam testing
# "


and so on

----------

This builds a three month lookback pile of spam compiled by 
day, that I can paw through using 'egrep' (I had an electronic 
payment notification email from a person lost in such 
recently)

-- Russ herrold