Mailbox Move (Open Source Edition)
As an example, we have a two server setup mail1.example.com & mail2.example.com. One should be able to move firstname.lastname@example.org from mail1.example.com to mail2.example.com as below. In the following steps, all commands are executed on mail1.example.com
1) Mark email@example.com status as 'Maintenance' as below:
zmprov -l ma firstname.lastname@example.org zimbraAccountStatus maintenance
2) Export email@example.com with zmmailbox:
zmmailbox -z -m firstname.lastname@example.org getRestURL "//?fmt=tgz&query=is:anywhere" >/email@example.com
3) Change account setting as below:
zmprov -l ma firstname.lastname@example.org zimbraMailHost mail2.example.com
zmprov -l ma email@example.com zimbraMailTransport lmtp:mail2.example.com:7025
4) Import firstname.lastname@example.org to mail2.example.com with zmmailbox:
zmmailbox -u https://mail2.example.com:7071 -a email@example.com -p yourpasswd -m firstname.lastname@example.org postRestURL "//?fmt=tgz&resolve=reset" /email@example.com
5) Mark firstname.lastname@example.org status as 'Active'
zmprov -l ma email@example.com zimbraAccountStatus active
6) Delete firstname.lastname@example.org MySQL records, also delete /opt/zimbra/store/0/$mailbox_id, /opt/zimbra/index/0/$mailbox_id. $mailbox_id can be found in MySQL table zimbra.mailbox
Please note after this move share references to email@example.com folders won't work, which means firstname.lastname@example.org will have to share his folders to others again.
I haven't written a script for step 6 yet. I'll post a script after I get it work for me.