How to merge two zimbra mailboxes


in ,

If you want to merge 2 zimbra mailboxes, you can simply export the source mailbox and import it to the target mailbox. This can be easilly achieved with a couple of zimbra commands.

  • SSH into your zimbra server.
  • Change to zimbra server:
    su - zimbra
  • Now type:
    /opt/zimbra/bin/zmmailbox -z -m [email protected] getRestURL "//?fmt=tgz" > /tmp/temp.tgz && /opt/zimbra/bin/zmmailbox -z -m [email protected] postRestURL "//?fmt=tgz&resolve=modify" /tmp/temp.tgz
    This is actually two commands in one line: first export to temp.tgz and, if export is successfull (&&), import to target mailbox.

Make sure you replace [email protected] and [email protected] with proper addresses.

If the old mailbox is big you may encounter the following error:

ERROR: zclient.IO_ERROR (Read timed out) (cause: Read timed out)

This is because the programmers of zmmailbox command have set a default timeout to avoid endless execution. Luckily for us, they have also supplied zmmailbox with the t option which let us specify the amount of time before the timeout error occurs. An infinite timeout is set with -t 0. So you may now want to rewrite the command like this:

/opt/zimbra/bin/zmmailbox -z -t 0 -m [email protected] getRestURL "//?fmt=tgz" > /tmp/temp.tgz && /opt/zimbra/bin/zmmailbox -z -t 0 -m [email protected] postRestURL "//?fmt=tgz&resolve=modify" /tmp/temp.tgz

Initially we have found the the idea in zimbra forums ( and we have also tried it many times in our own servers, especially with merging some multi giga byte accounts we manage and host.


5 responses to “How to merge two zimbra mailboxes”

  1. Timeout option dont’ working anymore. 🙁

    1. Just tried it on zimbra v8.8 and it still works. In which version have you tried it?

      1. Timeout option (-t 0) option isn’t working for me as well. I am using: Release 8.8.15_GA_3869.RHEL7_64_20190917004220 RHEL7_64 FOSS edition, Patch 8.8.15_P17.

        1. After how much time it times out? Can you specify the size of the mailbox and the specs of your machine? You could also try to modify memory allocation for zmjava command into zmlocalconfig. I hope it helps.

          1. Hi,
            Same issue for me.
            version – 8.8.15_GA_3869.RHEL7_64_20190917004220 RHEL7_64 FOSS edition, Patch 8.8.15_P24

Leave a Reply

Your email address will not be published. Required fields are marked *