Checkout http://wiki.dovecot.org/Plugins. You can search the mailing list archives for details on how to implement it. Timo has documented it a few times on the list.
I'll assume you're talking about the Trash plugin, yes? I've seen this and understand it, but it is quota based -- we don't use quotas, and it doesn't do what I want anyways. Something similar but was based on date (days) rather than Quota, and didn't empty that mailbox just deleted the
XXX days messages.
Actually, the plugin you are looking for is named Expire, but it does not work with the current Dovecot version. You need the CVS head version, which I do not believe is recommended for use in production. The Trash plugin is completely separate.
The Expire plugin is currently only mentioned in the Wiki in a paragraph at the bottom of the Lazy Expunge plugin. For some documentation on its use, see: http://www.dovecot.org/list/dovecot/2006-June/013864.html http://www.dovecot.org/list/dovecot/2006-November/017408.html
Scott