[Dovecot] automated mailbox trimming?

Andraž 'ruskie' Levstik ruskie at codemages.net
Wed Feb 2 14:11:03 EET 2011


:2011-01-31T20:10:Monique Y. Mudama:

> On Tue, Feb  1 at  3:07, Timo Sirainen penned:
> > > 
> > > What's the best way to go about mailbox trimming with dovecot's
> > > implementation of maildir?
> > 
> > http://wiki.dovecot.org/Plugins/Expire although it's a bit
> > annoyingly complex with v1.x. I'm guessing you don't have all that
> > many users, so v2.0 would make this simpler.
> > 
> > >  I was thinking of writing a script to simply move or delete old
> > >  files, but would I mess up dovecot's expectations for
> > >  directory/file structure that way?
> > 
> > There's "v1.0 cronjob equivalent" in the wiki page too. It'll work
> > fine, no messing up Dovecot.
> 
> Thank you.  You're correct about "all that many users" - with a
> whopping two users, the cronjob looks good to me =)

I have my own approach and just thought I give it here in case anyone is
interested.

http://codemages.net/archive_mail-1.0.tar.bz2

Contains:
archive_mail.sh - the core script
moveme - support script for final movement - used to do some hash
checking etc... but now it's a cp && rm
archmail.sh - the script I use to run archive_mail.sh

What the script does is:

You have INBOX
it will each time is run check for any messages based on fs mtime that
is older than N days and will store those messages into:
.archive.year.month

I run this daily and it helps keep all the mails down to a managable
level.

Hopefully it helps someone.

-- 
Andraž 'ruskie' Levstik
Source Mage GNU/Linux Games/Xorg grimoire guru
Re-Alpine Coordinator http://sourceforge.net/projects/re-alpine/
Geek/Hacker/Tinker

Be sure brain is in gear before engaging mouth.


More information about the dovecot mailing list