[Dovecot] Looking for IMAP maintenance tools

Chris Wakelin c.d.wakelin at reading.ac.uk
Tue Jan 30 23:42:34 UTC 2007



Kenneth Porter wrote:
> --On Tuesday, January 30, 2007 3:47 PM -0700 Jens Knoell
> <jens at surefoot.com> wrote:
> 
>> I'm currently prowling for some IMAP tools to help me maintain our
>> mailboxes. I'd prefer "pure" IMAP, i.e. no messing with file system
>> directly, but would settle for more crude ways if need be.
> 
> UW-IMAP came with a utility called mailtool that did that kind of thing.
> I recall that it could move messages around, but don't recall what, if
> any, other features it offered. It connected via IMAP to do its work.
> 
> 

Yes, we use it for pruning trash and spam folders, something like:

#! /bin/sh
LASTWEEK=`/usr/bin/perl -e 'use POSIX; print (strftime "%d-%h-%Y",
localtime (time - 7*24*60*60));'`

for trash in <path to folders>/*/mail/Trash; do
  mailutil prune $trash "Before $LASTWEEK"
done

The only downside is it may well rewrite the UIDVALIDITY which will
cause Dovecot to re-index (and the user will fail to open the folder
once). You could use an (UW c-client) IMAP path instead of "$trash", I
think, especially if you can have a master user (as in Dovecot). This
wouldn't have the UIDVALIDITY issue as all the rewriting is done by
Dovecot. Something like "{<imap
host>/notls/user=<username>*<masteruser>}mail/trash" (but I've not
tested it).

We also have a script that e-mails those over quota, using "find" on the
imap server itself.

Best Wishes,
Chris

-- 
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094


More information about the dovecot mailing list