Results 1 to 9 of 9

Thread: scripted deletion of email

  1. #1
    Join Date
    Aug 2008
    Location
    NL
    Posts
    68
    Rep Power
    7

    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 ?

  2. #2
    Join Date
    Dec 2006
    Location
    Minneapolis MN
    Posts
    777
    Rep Power
    9

    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!

  3. #3
    Join Date
    Aug 2008
    Location
    NL
    Posts
    68
    Rep Power
    7

    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...

  4. #4
    Join Date
    Aug 2008
    Location
    NL
    Posts
    68
    Rep Power
    7

    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

  5. #5
    Join Date
    Aug 2008
    Location
    NL
    Posts
    68
    Rep Power
    7

    Default

    Switched to using zmmailbox di instead of dm for the time being.

  6. #6
    Join Date
    Apr 2009
    Posts
    70
    Rep Power
    6

    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.

  7. #7
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,587
    Rep Power
    58

    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


    Acompli: A new adventure for Co-Founder KevinH.

  8. #8
    Join Date
    Apr 2009
    Posts
    70
    Rep Power
    6

    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

  9. #9
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,587
    Rep Power
    58

    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


    Acompli: A new adventure for Co-Founder KevinH.

Similar Threads

  1. [SOLVED] mailboxmanager does not start
    By jrefl5 in forum Administrators
    Replies: 18
    Last Post: 01-30-2012, 11:40 PM
  2. [SOLVED] Moving Zimbra to a new server
    By krolen in forum Administrators
    Replies: 109
    Last Post: 02-05-2009, 11:38 AM
  3. need advice on configuring zimbra to work with fax server
    By pheonix1t in forum Administrators
    Replies: 0
    Last Post: 07-11-2007, 08:46 PM
  4. upgrade to 4.0.3 antispam does'nt work
    By lucanannipieri in forum Administrators
    Replies: 14
    Last Post: 11-07-2006, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •