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

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 07-30-2009, 04:51 AM
Senior Member
 
Posts: 64
Default scripted deletion of email

Hi,

A number of departments in our organization receive a large quantity of email through Distribution lists. These messages are moved to predefined subfolders upon receipt. typically these messages become irrelevant after one of our employees handles them, but are stored for safekeeping.

Now everyone is SUPPOSED to maintain these folders and delete old email, but in practice this doesn't seem to happen

I want to write a script to clear out any message older than 2 months that is still present in these folders by creating a bash script that searches though all relevant accounts using zmmboxsearch to collect the message ID's and then using zmmailbox to delete the individual messages.

Is this the easiest way to go about doing this ?
Reply With Quote
  #2 (permalink)  
Old 07-30-2009, 06:28 AM
Outstanding Member
 
Posts: 717
Default

I'm pretty sure I saw an enhancement request in Bugzilla at one time (I don't have time to search for it at the moment, or else I would) to set message lifetime based on what folder it's in, where Zimbra would automatically delete email after a certain lifetime. It might be worth it to find that and vote for it.

Otherwise you're going to need to do a

for each mailbox {
while (search for a message matching a message id) {
delete message
}
}

and cross your fingers!
Reply With Quote
  #3 (permalink)  
Old 08-03-2009, 04:16 AM
Senior Member
 
Posts: 64
Default

It's coming along quite nicely,

I am wondering what the max nr of ID's is that I can pass on to zmmailbox ?

some of these folders in question contain up to 32k emails so my searches will result in a great number of message ID's...
Reply With Quote
  #4 (permalink)  
Old 08-04-2009, 06:11 AM
Senior Member
 
Posts: 64
Default

Oops,

I hit a snag,

I am running a query of this form : "beforedate) and under:inbox"

I have the query return met 100 results which get parsed using a regexp so that I end up with message ID's only. those are added to a csv, which is used by zmmailbox to delete the messages.

The problem is, that every time the query returns a message ID that happens to be an calendar invitation email zmmailbox returns:

zmmailbox returns :ERROR: mail.NO_SUCH_MSG (no such message: messageid)

manually deleting the item allows the process to continue.

shouldn't calendar invitations be deleted like normal email ? it is still an email after all ?

Regards

Jeroen
Reply With Quote
  #5 (permalink)  
Old 08-04-2009, 07:47 AM
Senior Member
 
Posts: 64
Default

Switched to using zmmailbox di instead of dm for the time being.
Reply With Quote
  #6 (permalink)  
Old 11-10-2009, 08:44 PM
Senior Member
 
Posts: 70
Default

Quote:
Originally Posted by jwilke View Post
Hi,

A number of departments in our organization receive a large quantity of email through Distribution lists. These messages are moved to predefined subfolders upon receipt. typically these messages become irrelevant after one of our employees handles them, but are stored for safekeeping.

Now everyone is SUPPOSED to maintain these folders and delete old email, but in practice this doesn't seem to happen

I want to write a script to clear out any message older than 2 months that is still present in these folders by creating a bash script that searches though all relevant accounts using zmmboxsearch to collect the message ID's and then using zmmailbox to delete the individual messages.

Is this the easiest way to go about doing this ?
Could you please tell how the mails through distribution lists can be sent to users predefined folders apart from INBOX etc.
Reply With Quote
  #7 (permalink)  
Old 11-10-2009, 11:09 PM
Zimbra Consultant & Moderator
 
Posts: 20,312
Default

Quote:
Originally Posted by tiarra View Post
Could you please tell how the mails through distribution lists can be sent to users predefined folders apart from INBOX etc.
The user creates a filter in their Preferences or the Admin can create a filter via a script. You can't send email to a predefined folder, it will always end up in their Inbox.
__________________
Regards


Bill
Reply With Quote
  #8 (permalink)  
Old 11-11-2009, 12:48 AM
Senior Member
 
Posts: 70
Default

Quote:
Originally Posted by phoenix View Post
The user creates a filter in their Preferences or the Admin can create a filter via a script. You can't send email to a predefined folder, it will always end up in their Inbox.
Can i have support on the script to create a filter for all accounts
Reply With Quote
  #9 (permalink)  
Old 11-11-2009, 12:51 AM
Zimbra Consultant & Moderator
 
Posts: 20,312
Default

Quote:
Originally Posted by tiarra View Post
Can i have support on the script to create a filter for all accounts
There are several threads in the forums that describe 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.