Automatically purge old emails

From Kolab Wiki

Jump to: navigation, search

You have two way to delete old emails on cyrus imap.

Expire - You can setup the 'expire' attribute of any mailbox you want to cleanup

You can setup the individual 'expire' attribute of any mailbox (or folder) to the number of days you want. Use 'none' to disable the expiration. This value is inherited by sub-folders!

 # cyradm -u manager localhost
 Password:
 cos5-eg.asxnet.loc> mboxcfg user/alain.spineux@mydomain.loc expire 30
 cos5-eg.asxnet.loc> info user/alain.spineux@mydomain.loc
 {user/alain.spineux@mydomain.loc}:
   condstore: false
   expire: 30
   lastpop:  5-Dec-2007 19:50:12 +0100
   lastupdate:  7-Jan-2008 00:00:43 +0100
   partition: default
   size: 3800
 cos5-eg.asxnet.loc>

Note: If you don't have the path set, you will need to use

 # /kolab/bin/cyradm -u manager localhost

Once a day (every 1440min) cyr_expire will purge the oldest messages.

 # grep cyr_expire /kolab/etc/imapd/cyrus.conf
   delprune      cmd="cyr_expire -E 3" period=1440

If you want to configure multiple mailbox or sub-folder at once, look at my "john, paul, george and ringo" tips somewhere else on the wiki.

Just to get the word spam in this page, I must add that it is a nice idea to configure such an expiration on the Spam folder.

ipurge: Use the cyrus ipurge tools

ipurge is able to remove messages that are older or larger than specified by its argument.

 # ipurge -d 30 user/alain.spineux*@mydomain.loc

Notice the use of the globbing char * to get subfolder too.

Read the manual if you want to get more.

Be careful any mistake in the pattern and you could erase mail of all the mailbox at once !

Personal tools