[Dovecot] Auto-expire messages in a folder

Mike Cisar mlists at starmania.net
Sun Nov 5 17:52:10 UTC 2006

I have a Fedora 5 server running Dovecot (currently 1.0 rc10).  The spam
filter (amavis) automatically tags email (using plussed addressing) such
that messages flagged as spam are sorted into a "spambox" folder by
procmail.  Seemed like a good idea at the time, but because of some legacy
issues with filesystem quota also being in place, combined with most users
connecting with POP3 rather than IMAP... spam doesn't stay in their inbox,
they don't check their spambox and they are very quickly over quota.

What I would like to do is stick with the "spambox" folder idea, but have
any messages in that folder which are older than a certain number of days
deleted automatically.  Could this be done by Dovecot?  If so how would
dovecot know to visit all the user's mailboxes to do it... or would it only
be able to do so when a user logged in via IMAP (as opposed to POP3)?  If
not, is anyone aware of a script that I could run in nightly maintenance to
do a cleanup pass on all the mailboxes?

I know there are any number of ways that this could be accomplished but I
would like to do it as much within my existing framework as possible...
sendmail/procmail/amavis on the delivery side, dovecot in the middle,
horde/imp for webmail and whatever email client the end users have (likely
Outlook/Outlook Express for the most part)... all pretty generic, standard
mailbox formats... nothing fancy like data stored in mySQL or anything like
that.  As everyone encounters, the more parts you change, the more other
parts you have to fix to be compatible with the changes :-)

Obviously I would like the solution to also be as feature rich as I can at
the same time (might as well wish for it all right :-).  Maybe for the sake
of the POP3 folks it would also be nice to generate a once-daily email with
the names, subjects of the messages in the folder saying "here's what is in
your spam folder, please log in to webmail to manage your spam" (and in a
perfect world some sort of link to click on which could move the message
from the spambox back into the inbox).

Does anyone have any solutions they can share that run within a similar
framework to what I have set up?

The thing that I need in the immediate term is to purge the spam folder
automatically, the mid-term goal is to evolve that into a sort of
spam-processing center/solution for the users.

Thanks for any suggestions!

>>>>> Mike <<<<<

More information about the dovecot mailing list