I need delete old messages from zimbra account.

by command:

zmmailbox -z -m mail@domain.com s -t message -l 999 "before:1/1/14" |awk '{ if (NR!=1) {print}}'| grep mess | awk '{ print $2 "," }' | tr -d '\n'

I can recieve ID messages and I can delete message by ID

zmmailbox -z -m mail@domain.com deleteMessage $ID

But between these two command, I would like to save the message in. tar.gz


You can create an backup with a command like:

zmmailbox -z -m mail@domain.com -t 0 getRestURL "//?fmt=tgz" > /tmp/mailbox.tgz

Where -t sets the timeout to infinity. You are creating a REST command to Zimbra, so you can extend this with compatible commands. For example, you can add a query to this to select message before a specific date:

zmmailbox -z -m mail@domain.com -t 0 getRestURL "//?fmt=tgz&query=before:12/31/2013" > /tmp/mailbox.tgz
| improve this answer | |
  • How about backup messages before 1/1/14? – Mielofon Jan 29 '16 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.