procmail
[Top] [All Lists]

Re: limit mesages per box

1998-07-21 20:45:10
On Tue, 21 Jul 1998, Brad Wyman wrote:

is it posible to set procmail to do this:

1: sort mail 
2: count the # of mesages already in the box
3: if there are "X" mesages in the box, deleate the oldist
4: put new mail in box


i need to do this for a few news groups that im on because the fill my
acount up to quickly, and if i cant get to my mail for a day or 2 i wind
up losing alot of mail because of the lack of space to sort it into. the
lists are expendable and i can alway go back to the archives, but im
losing personal stuff far to offen.

Well, yes, but I think you'll have to give up the single-mailbox model and
go with the message-per-file model.

Here's a "backup" snippet that keeps the 50 most recently received
messages, one per file in the "backup" directory. You may be able to adapt
it to your needs.


 #---------------------------------------------------------------------
 # Create a backup cache of 50 most recent messages in case of mistakes
 LOGABSTRACT=no
 
 :0 c
 backup
 
 :0 ci
 | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,50d`


See "man procmailrc" and "man procmailex" for details.

--
 John Hardin KA7OHZ                               
jhardin(_at_)wolfenet(_dot_)com
 pgpk -a finger://gonzo.wolfenet.com/jhardin    PGP key ID: 0x41EA94F5
 PGP key fingerprint: A3 0C 5B C2 EF 0D 2C E5  E9 BF C8 33 A7 A9 CE 76 
-----------------------------------------------------------------------
  Your mouse has moved. Windows NT must be restarted for the change
  to take effect. Reboot now?  [ OK ]
-----------------------------------------------------------------------
   96 days until Daylight Savings Time ends

<Prev in Thread] Current Thread [Next in Thread>