Import/Export Feature In Zimbra | Zimbra

Document
Alert! This article is written for Zimbra OSE users. As of December 2023, Synacor will no longer be providing support for Zimbra OSE. You might want to consider trying out Carbonio Community Edition – Zextras’s free and open-source email and collaboration platform.

For additional guidance, check out our community articles detailing the process of migrating from your current platform to Carbonio CE.

For enterprise-level requirements and advanced features, consider checking out Zextras Carbonio – the all-in-one private digital workplace designed for digital sovereignty trusted by the public sector, telcos, and regulated industries.

A regular user or a system administrator may need to import/export the data from their own email account or other user’s email account. In this guide, we will see how we can use the command-based import/export feature in Zimbra.

Web UI-based Import/Export

Zimbra webmail UI has an Import/Export feature under the preference settings. Both system admin and regular users can access the settings graphically and use this feature to import/export the data from their email accounts.

The most known purpose of the import/export feature can be either data migration or data backup. But you may find some other used cases also, in which you can use the import/export feature.

For a single user’s use, the system administrator may rely on the web UI import/export feature as it is very easy to use.

Import/Export feature in web UI

But if you have to migrate a large number of users or need to take backup of all of your users, then you can not rely on the manual web UI-based process. It will be time-consuming as well as complex to manage.

Possible Scenario

Let’s begin.

In this section, we will try to understand the scenario and step-by-step process to use the command-based import/export feature.

Scenario-1

Data migration from one server to another server

Scenario-2

Backup server data to an external data

Export Steps for Server-A (Source Server)

Follow the below instruction to export/extract data:

Create a directory to store all exported/extracted data

root@mail:~# mkdir -p /opt/backups/
root@mail:~# chown zimbra:zimbra /opt/backups/

Execute the below command to get the user’s email addresses along with their password

zimbra@mail:/opt/backups$ zmprozimbra@mail:/opt/backups$ zmprov -l gaa > emails.txt
zimbra@mail:/opt/backups$ ls
emails.txt

Extract all user’s mailboxes based on the email address list

zimbra@mail:/opt/backups$ for email in `cat /opt/backups/emails.txt`; do zmmailbox -z -m $email getRestURL '/?fmt=tgz' > $email.tgz ; echo $email ; done
zimbra@mail:/opt/backups$ ls
admin@testdomain1.com.tgz  flaminia@testdomain1.com.tgz          
imsilsa@testdomain1.com.tgz  spam.guxl4gg2za@testdomain1.com.tgz  
virus-quarantine.2cu4xh2hd@testdomain1.com.tgz
arman@testdomain1.com.tgz  galsync.yy1_sfy6@testdomain1.com.tgz  
irene@testdomain1.com.tgz  stefania@testdomain1.com.tgz
emails.txt                 ham.5e2sctqp@testdomain1.com.tgz      
suman@testdomain1.com.tgz
[You can use this command also to export/extract single user's mailbox]

Transfer/Store the data

If the above steps are performed for the data migration process then transfer these data to the destination server (Server-B) so that they can be imported.

If the above steps are performed for the data backup process then transfer these data to external storage for future use.

Import Steps At Destination Server(Server-B)

Create a directory to store all transferred data so that they can be used in the import process

root@mail:~# mkdir -p /opt/backups/
root@mail:~# chown zimbra:zimbra /opt/backups/

Create all email accounts on the new server

Import all data to the respective user’s mailbox

zimbra@mail:/opt/backups$ for i in `cat /opt/backups/emails.txt`; do zmmailbox -z -m $i -t 0 postRestURL "/?fmt=tgz&resolve=skip" /opt/backups/$i.tgz ; echo "$i -- finished "; done
[You can use this command also to import single user's mailbox]

The output of this command will look like this:

zimbra@mail:/opt/backups$ for i in `cat /opt/backups/emails.txt`; do zmmailbox -z -m $i -t 0 postRestURL "/?fmt=tgz&resolve=skip" /opt/backups/$i.tgz ; echo "$i -- finished "; done          

admin@testdomain1.com -- finished
spam.guxl4gg2za@testdomain1.com -- finished
ham.5e2sctqp@testdomain1.com -- finished
virus-quarantine.2cu4xh2hd@testdomain1.com -- finished
galsync.yy1_sfy6@testdomain1.com -- finished
stefania@testdomain1.com -- finished
flaminia@testdomain1.com -- finished
arman@testdomain1.com -- finished
irene@testdomain1.com -- finished
suman@testdomain1.com -- finished
imsilsa@testdomain1.com -- finished
zimbra@mail:/opt/backups$

With this step, all email data are imported to the new server’s mailboxes.

Most importantly, if you don’t want to do these tasks manually you can rely on Zextras Suite.

So that’s it for today.

:slight_smile:
Download Zextras Suite for Zimbra OSE

Comments

Gerais Tecnologia
04/07/2024

ERROR: account.NO_SUCH_ACCOUNT (no such account: galsync@domain.com.br)

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How To Change IP Address of Zimbra Server | Zimbra
What Does the GDPR Say About Consent? | Blog