deleting old trash mails

Dan White dwhite at olp.net
Tue Jan 18 10:00:35 EST 2011


On 18/01/11 14:01 +0200, Nikos Gatsis - Qbit wrote:
>Hello list
>Many of my clients are use imap accounts and they usually delete mails
>but don't purge them.
>
>Most of them use SquirrelMail, others Thunderbird.
>
>So I'm trying to make Cyrus to delete automatically after some days.
>
>I use cyrus-imapd-2.3.16-3.fc12.i686.
>
>In the imap.conf I put:
>
>...
>expunge_mode: delayed
>...
>
>And in the cyrus.conf:
>
>...
>delprune      cmd="cyr_expire -a -E 3 -X 10" at=0400
>...
>
>In maillog everyday I found the following records:
>
>...
>Jan 17 04:00:02 ns1 cyr_expire[12994]: mydelete: starting txn 2147487755
>Jan 17 04:00:02 ns1 cyr_expire[12994]: mydelete: committing txn 2147487755
>Jan 17 04:00:02 ns1 cyr_expire[12994]: duplicate_prune: purged 284 out
>of 786 entries
>
>but no mails deleted from trash.

Cyrus does not have any inherent understanding of what the Trash folder
is... it's just another IMAP folder.

'Deleted' in the IMAP sense refers to an email that has the '\Deleted' flag
set. A subsequent EXPUNGE will remove the emails from user view altogether.

Since the emails that are contained within the Trash folder probably do not
have the '\Deleted' flag set, they will not be expunged automatically by
Cyrus.

You could use ipurge to automatically delete messages from your users'
Trash folders. Adding something like this to the EVENTS section of your
cyrus.conf should work (please test as a typo could lead to loss of data):

purgetrash cmd="/usr/sbin/ipurge -f -d 14 */Trash" at=0301

Which purges all messages older than 14 days, in all users' Trash folders
and runs every morning at 3:01am. See the man pages for ipurge and
cyrus.conf for more details.

-- 
Dan White


More information about the Info-cyrus mailing list