Deleting messages "marked for deletion" older than X days

Wesley Craig wes at
Mon Aug 18 20:26:04 EDT 2008

cyr_expire -D and -X deal with delayed delete & expunge,  
respectively.  Neither will address message that the MUA hasn't  
already deleted (in the case of folders) or expunged (in the case of  

The tool that is closest to the desired functionality is ipurge.  In  
order for ipurge to do what you're asking, Gerard, it would have to  
examine whatever the "deleted" flag is for Outlook -- it varies by  
MUA, some set a flag, some move messages to a trash folder, etc.


On 18 Aug 2008, at 18:09, Kenneth Marshall wrote:
> In the manual page, the definition of the '-X' option seems to
> do what you want:
>       -X expunge-days
>               Expunge  previously deleted messages older than  
> expunge-days
>               (when using the "delayed" expunge mode).  The default is
>               0 (zero) days, which will expunge all previously  
> deleted messages.
>>> On Mon, Aug 18, 2008 at 03:35:20PM -0600, Gerard Beekmans wrote:
>>>> I am looking for a way to run a daily script on the Cyrus IMAP  
>>>> server
>>>> that processes every user's mail folders and deletes every message
>>>> marked for deletion older than X days.
>>>> I realize the proper way to do this is client-side and have the  
>>>> client
>>>> program purge/expunge the mailboxes periodically in some fashion.
>>>> Unfortunately in the corporate world there are many clients who  
>>>> still
>>>> use old versions of Outlook that only marks a message for  
>>>> deletion and
>>>> will not automatically purge the folder.
>>>> To force users to manually purge every single folder they have, one
>>>> folder at a time as some versions of Outlook can't do this  
>>>> recursively,
>>>> is not a feasible option. Users just stopped doing this because it
>>>> becomes too time consuming a task.
>>>> So I'm looking for a server-side solution that analyzes every mail
>>>> folder on the system, finds marked messages older than X days and
>>>> purges/deletes them on the client's behalf.
>>>> Some pointers are appreciated. I can write the scripts (shell,  
>>>> perl,
>>>> whatever) myself if need be, just need to know how to start  
>>>> going about
>>>> obtaining such a specific list of messages.

More information about the Info-cyrus mailing list