Re: Deleting messages "marked for deletion" older than X days

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bron,

Yes, it sounds like that's what I'm looking for: running expunge periodically.

Now there's one slight problem here: I can't just run expunge as it is. I have users who periodically need to undelete messages. I'd like expunge to only act on messages older than X days, giving people the chance to undelete messages within that time period.

I'll check out some IMAP libraries. Perhaps one offers to obtain a list of all messages with the \Deleted flag, then check its received time stamp and do the math on that. If older than X, delete/expunge/whatever it, else skip it.


Gerard Beekmans
IT Manager
Achilles Media
Tel: 403-678-1216 ext. 102
Email: gbeekmans@xxxxxxxxxxxxxxxxx



Bron Gondwana wrote:
On Mon, Aug 18, 2008 at 05:09:53PM -0500, 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.
    

Messages go through the following life cycle in "traditional IMAP",
example:

Created (\Recent)        - LMTP DELIVER (UID = 9)
No flags ()              - A001 SELECT INBOX (clears the \Recent)
Viewed (\Seen)           - A002 UID FETCH 9 RFC822
Deleted (\Deleted \Seen) - A003 UID STORE 9 +FLAGS (\Deleted)
Purged  (no message)     - A004 EXPUNGE

Now, what the -X option actually does is turns this into:

Created (\Recent)        - LMTP DELIVER (UID = 9)
No flags ()              - A001 SELECT INBOX (clears the \Recent)
Viewed (\Seen)           - A002 UID FETCH 9 RFC822
Deleted (\Deleted \Seen) - A003 UID STORE 9 +FLAGS (\Deleted)
Purged  (no index record)- A004 EXPUNGE

but the file is still on disk, just the index record has been moved
from the file cyrus.index to a new file cyrus.expunge.  A week later:

Cleaned up (no file)     - cyr_expire -X 7

The cyrus.expunge record and the actual spool file itself get deleted at
this point.  Until then you can un-delete the record using the
"unexpunge" command in cyrus 2.3.X.

---

I think what the original requestor was actually looking for is a tool
that can run the "EXPUNGE" phase on a regular basis.  As far as I'm
aware there's nothing that ships with Cyrus that can do it.  If I was
writing something for the job I would make an admin IMAP connection to
Cyrus and just cycle through the folders calling 'EXPUNGE' on them.
Cheap and nasty, but it would do the trick.  You can do this in any
language with a TCP library, though something with an IMAP interface
library would be nicer.  I'd use Perl and Mail::IMAPTalk, but that's
just because that's what I already use!

Bron.
  
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux