Index: [Article Count Order] [Thread]

Date:  Tue, 03 Oct 2006 08:21:09 -0500
From:  "William J.A. Brillinger" <billy (at mark) pdcweb.net>
Subject:  [coba-e:07387] Re: Grepmail on BQ (nuonce version)
To:  coba-e (at mark) bluequartz.org
Message-Id:  <6.2.5.6.0.20061003081851.01dcd9d0 (at mark) pdcweb.net>
In-Reply-To:  <20061003074841.GD42708 (at mark) xs4all.nl>
References:  <6.2.5.6.0.20061002154421.03afaf08 (at mark) pdcweb.net> <20061003074841.GD42708 (at mark) xs4all.nl>
X-Mail-Count: 07387

At 02:48 AM 10/3/2006, you wrote:
>On Mon, Oct 02, 2006 at 03:50:15PM -0500, William J.A. Brillinger wrote:
>
> > I need to process a users mailbox extracting messages that are newer
> > than 7 days and discarding the rest.
>
>Easiest way I think is to run mutt as root from the commandline and
>connecting to the user's mailbox using the -f parameter. You can then sort
>the messages on date, and delete the old ones.
>--
>Maurice de Laat
>Muis Netwerken

Grepmail worked great. here's what I did (script run from cron):

#!/bin/bash

tmp="/tmp/mail_swap_tmp"
age=7

echo Processing Correo Mailbox, removing messages older than $age days

         mailbox="/home/sites/SITENAME/users/USERNAME/mbox"

         grepmail -d "since $age days ago" $mailbox > $tmp

         was=`grep Date: $mailbox | wc -l`
         now=`grep Date: $tmp | wc -l`

         echo found $was messages
         echo leaving $now messages

         mv $tmp $mailbox
         chown USERNAME $mailbox




---------------------------------
William J.A. Brillinger
Precision Design Co.

E-Mail:   mailto:billy (at mark) pdcweb.net
Web site: http://www.pdcweb.net
Phone:    (204) 327-5524

	

7387_2.html (attatchment)(tag is disabled)