Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-2008, 06:01 PM
Loyal Member
 
Posts: 87
Default [SOLVED] How to delete data after a spcific data in inbox ?

My zimbra version is 509 . OS is Redhat as 5 .

My requirement is ,for example , I want to delete the mails which I recivied before oct 20

in inbox.

How could i do this with some tools ? I mean not delete them manually.
__________________
Ask Forever...
Reply With Quote
  #2 (permalink)  
Old 10-21-2008, 08:45 AM
Trained Alumni
 
Posts: 343
Default

Do you have access to the command line?

I used some Ruby to do this with Zimbra command line tools...
Code:
#Mark and Purge Old Messages
  msg_ids_for_deletion = smb(folder_path, "before:-30days")
  dm(msg_ids_for_deletion)
  msg_ids_for_marking = smb(folder_path, "before:-1day")
  if !msg_ids_for_marking.empty?
    mmr(msg_ids_for_marking)
  end
I've written some other Ruby that allows me to call Zimbra CLI commands with some parameters, that why I just call
Code:
smb(PATH, SEARCH_TERM)
and
Code:
mmr(MSG_IDS)
and
Code:
dm(MSG_IDS)
...instead of having to type out the full command.....but in Ruby you can do that with something like this...
Code:
msg_ids_for_deletion = `zmprov -z -a ACCOUNT search -l NUM -t message "in:Inbox before:-30days after:-60days"`
results = `zmprov -z -a ACCOUNT deleteMessage #{msg_ids_for_deletion}`
...or something like that anyway. That should search for and find all messages between 30 and 60 days old....and delete them. Test and verify first though as I'm just pulling most of that from memory.

Matt
Reply With Quote
  #3 (permalink)  
Old 10-22-2008, 06:11 PM
Loyal Member
 
Posts: 87
Default Thanks!

Thanks for a lot, I have solved this by your way .
__________________
Ask Forever...
Reply With Quote
  #4 (permalink)  
Old 03-09-2010, 07:23 AM
Special Member
 
Posts: 139
Default

Quote:
Originally Posted by marisu View Post
Thanks for a lot, I have solved this by your way .
How to I get this ruby stuff..?
Reply With Quote
  #5 (permalink)  
Old 03-18-2010, 06:44 AM
Zimbra Consultant & Moderator
 
Posts: 20,316
Default

Quote:
Originally Posted by Himanshu View Post
How to I get this ruby stuff..?
Look in the package management system for your distribution or look on-line for some blogs/tutorials on how to do it.
__________________
Regards


Bill
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.