[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to remove messages from mbox based on relative date?



On Tue, Apr 24, 2001 at 11:00:05AM -0400, Rob Mahurin wrote:
> On Mon, Apr 23, 2001 at 06:05:07PM -0700, Mike Fedyk wrote:
> > Hi,
> > 
> > I have a .procmailrc and am filtering, but now I don't want to have to
> > delete my messages when they get old in certain mbox files.
> > 
> > Can I run procmail with another conf file and have it send messages with a
> > "delivered" date older than N days?  Is procmail even the right tool, I'm
> > not so sure...
> 
> You can run procmail on existing mailbox if you use formail to split
> the box into messages, for example, 
> 
> mv mbox mbox.safe && cat mbox.safe | formail -ds procmail
> 
> You probably don't want to filter into and out of the same mailbox,
> though; might produce an infinite loop or erase all your mails.  I'm
> not sure how you do 'older than' in procmail.
> 
> You can also use mutt's folder hooks.  For example, I have

I've looked into this, and neither procmail nor formail have any facilities
to process mail based on date, unless it's the current date.

You could have mail put in a folder 04-2001 for instance, but that is based
on the current date and not the date in  the message.  You could probably do
some matching on the "date:" header but I don't want to do that.

> 
> #
> # Tag "old" messages in mailinglists for "expiring" them.
> # Simply press "d", after entering one of the folders, iff mutt asks
> # "tag-"
> #
> folder-hook =debian-user$ 'push T~r>2w\n\;'             # 2 weeks
> 
> in my .muttrc, so when I switch to =debian-user and there are old
> messages I see 'tag-' at the bottom of the screen and hit 'd' to
> delete everything that's old.  Note that with 'push' mutt can do just
> about whatever you want.
> 
Perfect!!!  I'll do that on my folders and make a cron script to fix up my
mail folders on my mail server.

I have a bunch of users that keep messages on the server, but the client
won't delete the messages automatically.  Cucipop will delete the message if
it's older than a certain date, but only if the client tries to _retr_ it
when it's old enough.  Since it does a uidl and knows it doesn't need to get
that message again it won't and I get mail that is several months old on my
server.

I can have cucipop change the uidl once the message gets old enough, but
then the client receives old mail, and people getting 200+ messages that
they've already read doesn't go over very will with them...

mutt -e "push..." will be a lifesaver. :)

Does anyone see anything I haven't thought of already?  Oh, yes I know
outlook will delete messages on the server "older than..." but I don't want
to have to depend on the client being configured correctly, and most don't
use outlook thankfully.

Mike



Reply to: