You could do this with any IMAP library in the language of your choice.
I prefer Perl for quick scripts like this one, but it's by no means the
only way to go. 

So a very simple approach would look like this in the IMAP commands
exchanged between your program and Cyrus:

* OK mail.cpicorp.com Cyrus IMAP4 v2.1.2 server ready
. login cyrus {cyrus password}
. OK User logged in
. LIST * *
* LIST (\HasChildren) "." "user.wayner"
* LIST (\HasNoChildren) "." "user.wayner.Drafts"
* LIST (\HasNoChildren) "." "user.wayner.Sent"
* LIST (\HasNoChildren) "." "user.wayner.Trash"
* LIST (\HasChildren) "." "user.websurvey"
* LIST (\HasNoChildren) "." "user.websurvey.Trash"
* LIST (\HasChildren) "." "user.wendyc"
* LIST (\HasNoChildren) "." "user.wendyc.Adrian"
* LIST (\HasNoChildren) "." "user.wendyc.Sales Dogs"
* LIST (\HasNoChildren) "." "user.wendyc.Sent"
* LIST (\HasNoChildren) "." "user.wendyc.Trash"
... and so on, Cyrus returns a list of all mailboxes here, have your
script save them to an array of strings and then for each mailbox, you
will need to give the cyrus user permissons to delete messages from the
mailbox, then select the mailbox, and run a search something like this
(check the IMAP syntax, I'm not 100% sure it's right - this should
return the message numbers of all SEEN messages received before this
year):
. SEARCH SEEN NOT SINCE 1-Jan-2002

Then you just set the deleted flag on these messages, expunge the
mailbox, reset the mailbox's permissions, and move on to the next
mailbox.

-Jules


On Mon, 2002-04-15 at 07:44, Derek Chen-Becker wrote:
> Hi,
>      I was wondering what utilities are out there for purging old 
> messages from users' mailboxes. I've looked at ipurge and someone on the 
> list posted about a program called "Janitor" last year, but we're 
> looking for something with a little extra functionality. Specifically, 
> we would like to delete old *read* messages from the users' INBOXes. If 
> there isn't anything out there that does this, is there any sort of API 
> that would allow me to check read/unread status on messages in a folder?
> 
> Thanks,
> 
> Derek
> 
> -- 
> ========================================================================
> Derek Chen-Becker
> Senior Network Engineer
> CPI Corp, Inc.
> 1706 Washington Ave
> St. Louis, MO 63103
> 314-231-1575
> [EMAIL PROTECTED]
> PGP Key available from public key servers
> Fingerprint: 1C34 D81E D8A0 641D 6C8C  E952 3B15 693F 9184 BC58
> ========================================================================
> 


Reply via email to