procmail
[Top] [All Lists]

Re: Auto removal of older mail

1998-05-06 12:53:33
Is it possible to have procmail automatically check a particular mail 
folder for mail that has been there for a long time (say, 1 week or 1 
month) and delete it?  Is a script available for a function like this?

This wouldn't make much sense -- procmail filters *incoming* mail; it's not
designed to handle mail that's already been delivered.

Here's a simple solution:

(1) First, set up procmail to use mh-style mail folders.  That means
    that recipes looking like this:

    :0:
    mailbox

    Need to be changed to look like this:

    :0:mailbox/.lock
    | rcvstore +mailbox

    With this configuration, each message is stored in a seperate file.
    Any good mail user agent will support mh mail folders (this includes pine,
    and anything that uses IMAP to access your mail, and maybe
    others as well).

(2) Now, to delete messages older than one week, you can do something
    like this:

    rmm `pick +mailbox -before -7`

    Stick that in a cron job and run it regularly and you're all set!

Note for sticklers: yes, someone has written a procmail filter that will
"delete" messages older than a certain date.  It works by taking your mailbox,
re-filtering it (discarding older messages), and then putting your mailbox
back.  I think this is an ugly, resource intensive solution.  I don't know
how robust it was -- it showed up on this list some time ago.

-- Lars

---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University

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