Subject: Re: mail housecleaning - help!

From: "Steven D. Majewski" <[email-masked]>
Date: Mon, 10 May 1993 14:18:21 -0400

On May 10, 10:12, "Jeff A. Earickson" wrote:
>
>    --> I need to clean out old mail.  How best to do it? <---
> 
> I would like to go thru every mail file and delete all messages older than
> say 6 months.  Is there some way to do this from within pine?  Some other
> program out there that does this?  A Unix utility that I don't know about?
> Help!
> 
> -- End of excerpt from "Jeff A. Earickson" <[email-masked]>

For interactive housecleaning:
Mush ( Mail Users SHell ) has more powerful selection & sorting &
marking capabilities - and commands can be 'piped' together, as 
in unix shells ( except that, from one mush command to another,
what is passed is a message LIST, not the messages, but when you
pipe a message list to a unix command, it is the messages that 
get sent. ) 
  'pipe -i -s unsubscribe | delete ' 
for example, will delete all the messages with "unsubscribe" in the
subject line ( -i is (following 'grep') case insensitivity ).

For Batch housecleaning I've used both 'filter' - a program that comes
with the mush package, and 'procmail/formail'. Both are really designed
to intercept incomming mail ( via an entry in your .forward file ) and 
route it to a particluar folder|user|program, but both can be run in 
"batch" mode. The usual .forward method simply runs the program with
a mail message as the stdin. That's where the 'formail' program 
( part of 'procmail' package ) comes in handy : formail can split up
a mailbox file, and pipe each message to a unix command:

  'formail <mbx -s procmail ./.procmailrc' 

will break up mailbox file "mbx" into separate messages and pipe each
one to the command 'procmail ./.procmailrc' , where ".procmailrc" is 
a file of procmail rules. 

[ Both procmail and filter need a "rule" file to pick and redirect  
  messages.  ] 

-Steve Majewski             (804-982-0831)              <[email-masked]>
-Univ. of Virginia Department of Molecular Physiology and Biological Physics