Subject: Re: Copy of all mail recieved?

From: Andy Rowan <[email-masked]>
Date: Fri, 5 May 1995 13:40:21 -0400

Neil McRae wrote
 >I want to keep a copy of all mail recieved, Does someone have a cookie?

Bake your own cookies.  Here's the recipe, should be the first one
in .procmailrc

:0 c:
/home/where/ever/you/want

Then you better put in a cron job every month or so to prune the sucker!

==================================================
| Andy Rowan                                     |
| Center for Remote Sensing and Spatial Analysis |
| Rutgers University, New Brunswick NJ USA       |
| [email-masked]                        |
==================================================

---

From: Jon Lewis <[email-masked]>
Date: Sat, 6 May 1995 01:49:18 -0400 (EDT)

> Then you better put in a cron job every month or so to prune the sucker!

Is there a program already available that will prune such a mail file by 
removing messages from the beginning (older ones), that can be used from 
a crontab?  With the help of procmail, I've setup a WWW guestbook, and 
would like an automated method of pruning the guestbook by remoing the 
oldest messages from it.  Currently, I edit the guestbook via Pine, but 
an automated method would be nice.

------------------------------------------------------------------
 Jon Lewis                      |  Mime attachments are OK
 [email-masked] |  But please ask before sending 
 http://inorganic5.chem.ufl.edu |  unsolicited huge files.
                                |  
_____Finger [email-masked] for PGP public key_____

---

From: [email-masked] (David W. Tamkin)
Date: Sat, 6 May 1995 14:32:11 -0500 (CDT)

Jon Lewis asked,

| Is there a program already available that will prune such a mail file by 
| removing messages from the beginning (older ones), that can be used from 
| a crontab?  With the help of procmail, I've setup a WWW guestbook, and 
| would like an automated method of pruning the guestbook by remoing the 
| oldest messages from it.  Currently, I edit the guestbook via Pine, but 
| an automated method would be nice.

That depends on how you determine the dividing line between "older" and "not
older."  That really consists of several questions: first, do you decide age
by date of receipt, date of sending, or position in your mailbox [fortunate-
ly, in the case of your guestbook, those might all yield the same sequence];
second, do you decide how many to keep by number of messages in your box or
by number of days since a message was sent (or received)?

In the very simplest case, you can remove the first N messages from a folder
this way:

  formail +$N -s < folder > tempfolder
  mv tempfolder folder

Another entirely different tack might be to start a fresh guestbook folder
every day and then to rm each folder in whole after so many days (or to
get the same effect with mv).

---

From: Jon Lewis <[email-masked]>
Date: Sun, 7 May 1995 01:15:22 -0400 (EDT)

> by number of days since a message was sent (or received)?
 
Ideally, I'd like to keep say, the last 50kb of messages, purging the 
earlier ones (earlier as in the ones closest to the beginning of the 
file), without cutting messages in half.  I suppose I could write such a 
thing in perl...but why reinvent the wheel if it's already been done?

---

From: [email-masked] (David W. Tamkin)
Date: Sun, 7 May 1995 21:51:26 -0500 (CDT)

Jon Lewis clarified,

| Ideally, I'd like to keep say, the last 50kb of messages, purging the 
| earlier ones (earlier as in the ones closest to the beginning of the 
| file), without cutting messages in half.  I suppose I could write such a 
| thing in perl...but why reinvent the wheel if it's already been done?

You're asking for a tool that examines text, measures text size, and alters
text.  Perl sounds ideal.

I see the problem like this:

1. If the folder is 51,200 characters or shorter, leave it alone.
2. Otherwise, open it and find the point 51,200 characters before the
   end.  If it's the F of `From ' in a postmark, or if it's the newline
   preceding a postmark, mark it.
3. Otherwise, back up to the next preceding postmark and mark there.
4. Delete all text preceding the marked point.

One complication is telling the difference between the `From ' of a postmark
and left-anchored a `From ' in text that is protected by a Content-Length:
header rather than being escaped into `>From '.  Maybe you could filter the
folder through formail -Ys first (without -e!) to take care of those, if
I understand formail -Y correctly.