ipurge / cyr_expire with recursion

Heinzmann, Robert Heinzmann at cc-dresden.de
Thu Jul 27 03:49:48 EDT 2006


I have a problem with ipurge and cyr_expire (cyrus 2.2.3 from SuSE SLES

We have the requirement to delete all e-Mails in a users INBOX (non
recursive) and the users SPAM and TRASH folders (recursive) after 90
day. Mails in folders created by the users should not be deleted. 

Lets say the user has the following folder structure: 

  |- Mailinglists
      |- Apache
      |- Tomcat
  |- Archive 
      |- October
      |- November
  |- Spam (*)
      |- Jan (*)
      |- ... (*)
      |- Dec (*)
  |- Trash (*)

All mail in folders marked with a (*) that are older than 90 days should
be deleted. If the user creates a folder "TEST" it should look like this
(no automatic deletion of mails in TEST): 

  |- Mailinglists
      |- Apache
      |- Tomcat
  |- Archive 
      |- October
      |- November
  |- Spam (*)
      |- Jan (*)
      |- ... (*)
      |- Dec (*)
  |- Trash (*)
  |- TEST

All mails in the SPAM and TRASH folders should be deleted recursivly
--> This is working well with ipurge and the pattern "user.%.Spam" and

ipurge -d 10 -f 'user.%.Spam'
Working on user.XXXX.Spam...
total messages                   20
total bytes                      5438
Deleted messages                 9
Deleted bytes                    2446
Remaining messages               11
Remaining bytes                  2992
Working on user.XXXX.Spam.XXXXX...
total messages                   19
total bytes                      5186
Deleted messages                 8
Deleted bytes                    2183
Remaining messages               11
Remaining bytes                  3003

The deletion of mails in the INBOX should NOT be recursive, because it
would be fatal.
 --> This is not possible with ipurge, because it always works

To solve this issue I thought about using the "cyr_expire" "cron job". I
can mark a mailbox with the expire flag (mailboxcfg user.XXXX expire
90), but the problem here is, that this is also recursive. To get the
solution I have I would have to do the following: 

mailboxcfg user.XXXX expire 90
mailboxcfg user.XXXX.* expire 0
mailboxcfg user.XXXX.Trash* expire 90
mailboxcfg user.XXXX.Spam* expire 90

This sets the right expiration dates I want as "info user.*" shows. Also
cyr_expire deletes all the e-Mails accordingly. 

The problem with this solution is, that if a user creates a Mailbox, it
automatically inherits the expiration settings of the parent. If the
folder is created below the INBOX, all mails in this folder are also
deleted after 90 days --> PROBLEM.

So none of the two solutions is working a 100% ok (of course I could set
up a cron job always running before the cyr_expire job setting the
expiration date for all Mailboxes that do not already have a expiration
date associated to 0. This is error prone:

- The job setting expiration dates for all folders not having a
expiration date associated yet runs
- A user creates a mailbox and copies all of ist mails to this new
folder (archiving)
- The job cyr_expire runs and deletes all e-Mails older that 90 days

Is there any other way to get this working with cyrus 2.2.3 ? Does a
later version of cyrus provide this feature ? 


CC Computersysteme und Kommunikationstechnik GmbH 
Robert Heinzmann
Wiener Str. 114 - 116		Email:	heinzmann at cc-dresden.de
01219 Dresden			Telefon:	+49 (0)351/8 76 92-0
					Telefax:	+49 (0)351/8 76

More information about the Info-cyrus mailing list