Jump to content

Zimbra Restore Mails From Store Folder: Difference between revisions

From TetraWiki
No edit summary
No edit summary
Line 12: Line 12:
  echo "" >> /tmp/messagelist
  echo "" >> /tmp/messagelist
  done
  done
 
This will return a list of top ten users (in '''/tmp/messagelist''') whose name is present in the 'To:' field of the messages stored.
This will return a list of top ten users (in '''/tmp/messagelist''') whose name is present in the 'To:' field of the messages stored.
Using the output of this, we can make a good estimate of the user's folder, but this needs to be confirmed manually as well, by reading the email.
Using the output of this, we can make a good estimate of the user's folder, but this needs to be confirmed manually as well, by reading the email.

Revision as of 11:41, 25 July 2012

Go to the backup store folder:

cd /opt/zimbra/store.old/0

Use the following script:

#!/bin/bash

for line in `ls`; do
echo $line >> /tmp/messagelist
cat $PWD/$line/msg/0/* | grep To: | sed 's/To: //' | sort | uniq -c | sort -nr | head -5 >> /tmp/messagelist
echo "" >> /tmp/messagelist
done

This will return a list of top ten users (in /tmp/messagelist) whose name is present in the 'To:' field of the messages stored. Using the output of this, we can make a good estimate of the user's folder, but this needs to be confirmed manually as well, by reading the email.


The mails can then be recovered by using zmmailbox as the Zimbra user.

Both the commands below give admin rights on zmmailbox prompt, so use any one.

zmmailbox -zadmin

or

zmmailbox adminAuthenticate -u https://server.domain.com:7071 admin@domain.com password

After that we create the 'Recovery' folder, and add messages to that folder from our old store folder.

mbox> selectMailbox agmadmin@witalsee.com
mbox agmadmin@witalsee.com> createfolder /Recovery
mbox agmadmin@witalsee.com> addMessage /Recovery /opt/zimbra/store.old/0/809/msg/0

/opt/zimbra/store.old/0/809/msg/0 is the path to the folder containing the mails. Some IDs may have a large amount of mails, resulting in msg/1, msg/2, etc. These will have to be run one-by-one.