[Dovecot] (somewhat ot?) purging old maildir messages
Matt LaPlante
cyberdog3k at gmail.com
Thu Jan 3 07:02:40 EET 2008
I'm using Dovecot (+postfix) to host some personal imap accounts on a
private server (Maildir format). I've got one account that receives
mostly automated mails, and I want to be able to purge messages beyond
a given date (say 30 days).
I know that since maildir uses flat files, I can literally just delete
messages doing something similar to the following with bash:
for i in $(find /var/spool/vmail/host1/user/cur/ -mtime +30); do
rm $i
done
I dislike this approach for a few reasons. First, and most plainly,
it seems crude. When running complex server software, its rarely a
good idea in the field of systems administration to be bluntly
deleting files out from under the running applications. It feels
wrong. How does this affect dovecot's monitoring of the files and
indexing? What if the files happen to be open in an email client?
Etc.
Emotions aside, I also very much dislike running an automated 'rm'
that has the power to wipe out a lot of my email if something goes
pearshaped with the script.
I can think of several possible solutions that don't require
subversive operations on the maildirs, but I've never used them and
therefore don't know if they're actually feasible:
- Use a tool designed to manipulate maildirs. Something akin to
postfix's postqueue and postsuper tools come to mind, but I don't know
if such an app exists.
- Use a setting within dovecot that expires old maildir data. As I
understand it this will be available in 1.1 (yay!); unfortunately
that's not an option for me until 1.1 is available as stable in my
server os.
- Use a scriptable mua that has the capability to check mail under
said account and automatically delete based on age. I know very
little of tools in this area, so again I don't know if such an
application exists.
Any pointers you might have would be much appreciated.
Thanks,
Matt
More information about the dovecot
mailing list