On Thu, 19 Nov 1998 13:44:06 -0600 (CST), Mark Shaw
<mshaw(_at_)asic(_dot_)sc(_dot_)ti(_dot_)com> wrote:
Once a month or so I'd like to process the default mail-
box through procmail and delete all messages that con-
tain the mailing-list header. All messages that do not
contain that header would be deleted from the default
mailbox and filed to a folder I'd define at the time I
ran this task. I'd be left with an empty default mail-
box.
Assuming "default mailbox" equals $DEFAULT in Procmail equals $MAIL in
your interactive shell, use the "cron" script from procmail's manual
page but run Procmail with an rc.file with the recipes for this.
They'd look something like
SHELL=/bin/sh # Paranoid
DEFAULT=$HOME/Mail/wanna-keep-these # Where to store matches
:0
* ^that-pesky-header
/dev/null
This is a bit risky because if e.g. the $HOME/Mail directory doesn't
exist, or you don't have the permission to write to wanna-keep-these,
all the non-matching messages will be written back to your $DEFAULT,
but from your description of how you'd use this, I wouldn't worry
(just fix the problem and run the script again, or something).
(So in the "cron" script from procmail(1), you'd say
formail -s procmail ./rc.listkills <.newmail &&
...
if you had saved the above recipe snippet in the file ./rc.listkills.)
- I'd also like to run all my mailing-list mail folders
through a recipe that would delete all messages older
than X number of months.
In the general case, this is an awfully hard problem. Messages have
several date stamps so you'd have to sort out what precedences to give
them (trust Date? Trust From_ line? Ignore discrepancies between the
two? Have a date parser which can handle all the variation you see in
Date: headers if you are going to rely on that? Fortunately, if your
local system writes the From_ lines in a consequent way, that should
be good enough) and write a script that does some inelegant back and
forth copying.
They say mush is able to do this rather nicely; you might want to
investigate that. (Search the list archives for matches on "mush",
that should get you the information you need. The list is archived at
<http://www.rosat.mpe-garching.mpg.de/mailing-lists/procmail/>.)
/* era */
--
.obBotBait: It shouldn't even matter whether <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>