Results 1 to 4 of 4

Thread: Delete all emails prior to 31/12/2012 (approx 40.000)

  1. #1
    mafiabusiness is offline Active Member
    Join Date
    Jan 2014
    Location
    London, UK
    Posts
    27
    Rep Power
    1

    Default Delete all emails prior to 31/12/2012 (approx 40.000)

    Hi there,

    I have a user with 75.000 emails in her inbox.

    She wants to…

    delete all emails prior to 31/12/2012 (a 'large portion of the 75.000 e-mails')
    move all e-mails from 1/1/2013 - 31/12/2013 to a folder called OLD INBOX

    …and keep the rest, e.g all emails from this year.

    Can anybody give me any ideas of how this could be done?

    Setting up the account in an email client is not viable
    Doing it in webmail would possible if it could allow me to see emails either 'separated by year' or indeed 'show 20.000 emails per page'. The current 100 is a bit low..
    Synchronise one account with another using imap sync, where perhaps it is possible to do so from-to a set of dates, and then delete the other account?

    I have searched the forums, and it looks to me that Zimbra would do good at implementing this as a feature in the Admin GUI, baring in mind the number of posts in the matter.
    Call it "e-mail management" and when selected, choose account, select date interval and action (delete / archive / move).

    I use the Open Source version of Zimbra, 8.0.7.

    Any ideas of how I would proceed?

    Miguel

  2. #2
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,499
    Rep Power
    56

    Default

    How about one of the previous forum threads on this topic? To move the mail to another folder she could use a filter and run it against the current mail.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  3. #3
    mafiabusiness is offline Active Member
    Join Date
    Jan 2014
    Location
    London, UK
    Posts
    27
    Rep Power
    1

    Default

    Lovely.

    so I made a new text file on the server

    nano dateremove.sh

    I pasted this into it

    ------------------------------------------------------------------------------------------------------------------------------------------------
    #!/bin/bash
    #version .1
    #

    ZIMBRA_BIN=/opt/zimbra/bin
    echo "Enter the username.:"
    read THEACCOUNT

    echo "Enter the time that you would like to delete messages up to, in mm/dd/yy format. Example 04/10/09:"
    read THEDATE

    echo "What folder would you like to delete these messages from?:"
    read THEFOLDER

    echo "You will now be deleting Messages from the $THEFOLDER folder up to $THEDATE for $THEACCOUNT."
    echo "Do you want to continue? (y/N): "
    read ADD

    themagic ()
    {
    touch /tmp/deleteOldMessagesList.txt
    for i in `$ZIMBRA_BIN/zmmailbox -z -m $THEACCOUNT search -l 999 "in:/$THEFOLDER (before:$THEDATE)" | grep conv | sed -e "s/^\s\s*//" | sed -e "s/\s\s*/ /g" | cut -d" " -f2`
    do
    if [[ $i =~ [-]{1} ]]
    then
    MESSAGEID=${i#-}
    echo "deleteMessage $MESSAGEID" >> /tmp/deleteOldMessagesList.txt
    else
    echo "deleteConversation $i" >> /tmp/deleteOldMessagesList.txt
    fi
    done

    $ZIMBRA_BIN/zmmailbox -z -m $THEACCOUNT < /tmp/deleteOldMessagesList.txt >> /tmp/process.log
    rm -f /tmp/deleteOldMessagesList.txt
    echo "Completed. Run again for same user?"
    read ADD
    }


    while expr "$ADD" : ' *[Yy].*'
    do themagic
    done
    ------------------------------------------------------------------------------------------------------------------------------------------------

    (without the long lines)

    I then ran it

    sudo bash dataerase.sh

    entered the users email address
    entered the desired date up until which I would love to have all erased
    entered what folder, in this case, INBOX
    I selected Y as in YES to proceed

    A few seconds later, it told me that it had tone a good job and asked if I wanted to proceed (seeing that it only does 999 at a time, I had to run it a few times).
    Voila.
    Very happy.

    Hopefully this will help somebody else also.

    Thank you Bill.

    Miguel

  4. #4
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,499
    Rep Power
    56

    Default

    I'm glad that worked for you and thanks for posting your script.
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to delete old emails from an account (ZCS 7.02)
    By theboina in forum Administrators
    Replies: 3
    Last Post: 01-14-2014, 04:31 PM
  2. [SOLVED] Sent emails are been delete
    By isacap18 in forum Administrators
    Replies: 5
    Last Post: 07-10-2009, 03:20 PM
  3. Server spec for approx. 400 users
    By ldejongh in forum Installation
    Replies: 8
    Last Post: 08-15-2007, 01:42 PM
  4. Delete tagged emails
    By EriSan500 in forum Users
    Replies: 1
    Last Post: 01-31-2006, 07:59 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
  •