Greetings and welcome to this guide on how to migrate emails from Gmail / Google Gsuite to Zimbra. This guide mainly focuses on making it easy for you to perform email migrations from Google to Zimbra. In our previous guides, we walked through how to install the Zimbra collaboration suite.

Zimbra is an open-source email and collaboration suite developed by Synacor, Inc. It provides a rich set of tools and features that make collaboration across and outside the organizations easy. Zimbra is provided in two editions:

  • Free open-source edition.
  • Enterprise Edition/Network Edition with a 60-day free trial.

Gsuite, currently known as Google Workspace is a cloud-based collaboration suite provided by Google. It is used by several organizations and educational institutions for communication and collaboration. There are quite a number of applications and services provided by Google Workspace. These include Google Drive, Google Docs, Google Sheets, Google Slides, Google Forms, Google Calendar, Google Meet, Google Chat, Google Sites, Google Keep, Google Vault, Google Admin Console, Google Mobile Device Management (MDM), Google Workspace Marketplace and Gmail. All these components help streamline collaboration and enhance productivity in an organization.

Zimbra and Gsuite are collaboration suites but differ in features, prices and deployment options. Here’s the main difference:

Zimbra provides both on-prem and cloud-based options for deployment. This gives the organization more control over the infrastructure. Google Workspace on the other hand only provides a cloud-based deployment option and entirely relies on Google’s cloud infrastructure.

This guide provides the steps that can be used to migrate emails from Gmail / Google Gsuite to Zimbra for those who have preferred it to Google Workspace.

Prepare the Zimbra Server

The first step is ensuring that your Zimbra server is ready for the migrations. First. login to the Zimbra Admin console and navigate to Configure -> Global Settings -> IMAP then enable clear text login as shown:

Migrate emails from GmailGoogle Gsuite to Zimbra

Save the changes and proceed to increase the attachment size required from email synchronization for files larger than the default 10MB size

To achieve that, go to Configure -> Global Settings -> General Information then set the required size for the Briefcase, Email messages, Calendar appointments and Tasks in KBs

Migrate emails from GmailGoogle Gsuite to Zimbra 1

In this demo, I have provided 1048576 KBs which is equivalent to 1GB.

Install Imapsync on Your System

We will use Imapsync to perform email migrations from Gmail / Google Gsuite to Zimbra. To achieve that, we need to have it installed on your system.

You can install Imapsync using any of the two methods below:

Option 1: Install Imapsync from Repositories

Imapsync can be found in the EPEL repository of Rhel-based Linux systems. To install it, use the below commands:

Add the EPEL repository:

sudo yum install epel-release

Once added, use the below commands to install Imapsync:

##For EPEL 7
sudo yum install imapsync

##For EPEL 8
sudo  dnf install --enablerepo=powertools imapsync

##For EPEL 9
sudo dnf config-manager --set-enabled crb
sudo yum install imapsync

Once installed, verify with the command:

$ imapsync -version
2.229

Option 2: Install Imapsync from Binaries

You can also build and install Imapsync from a binary file. First, install all the required packages:

  • On Debian/Ubuntu
sudo apt update -y
sudo apt-get install gcc libssl-dev libauthen-ntlm-perl libdata-uniqid-perl libdigest-hmac-perl libdist-checkconflicts-perl libfile-copy-recursive-perl libio-compress-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libmail-imapclient-perl libmodule-scandeps-perl libnet-ssleay-perl libpar-packer-perl libreadonly-perl libsys-meminfo-perl libterm-readkey-perl libtest-fatal-perl libtest-mock-guard-perl libtest-pod-perl libtest-requires-perl libtest-simple-perl libunicode-string-perl  make cpanminus

Once complete, install all the required Perl modules:

sudo cpanm Mail::IMAPClient
sudo cpanm JSON::WebToken
sudo cpanm Readonly
sudo cpanm Test::Pod
sudo cpanm File::Copy::Recursive
sudo cpanm Encode::IMAPUTF7
sudo cpanm Regexp::Common
sudo cpanm File::Tail module
  • On RHEL/Rocky/Alma Linux/CentOS

Install the EPEL repository:

sudo yum install epel-release -y

Enable the PowerTools repo:

##For EPEL 8
sudo dnf config-manager --set-enabled powertools

##For EPEL 9
sudo dnf config-manager --set-enabled crb
sudo yum install perl-English

Now install all the required packages:

sudo yum install perl-Crypt-OpenSSL-Bignum perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random perl-Data-Uniqid perl-Encode-IMAPUTF7 perl-File-Copy-Recursive perl-IO-Socket-INET6 perl-IO-Tee perl-JSON perl-JSON-WebToken perl-Mail-IMAPClient perl-Parse-RecDescent perl-Readonly perl-Socket6 perl-Test-MockObject perl-Test-Pod perl-Compress-Zlib perl-Digest-HMAC perl-File-Tail perl-NTLM perl-Proc-ProcessTable perl-Regexp-Common perl-Sys-MemInfo perl-TermReadKey perl-Unicode-String
  • Download and Install Imapsync

Now once the required packages have been installed on the Debian/RHEL-based system, download the latest available Imapsync release from the GitHub repository. You can also export the tag:

VER=2.229

Now download it with the command:

wget https://github.com/imapsync/imapsync/archive/refs/tags/imapsync-$VER.tar.gz

Extract the archive and copy the binary to your PATH

tar -xvf imapsync-*.tar.gz
cd imapsync-imapsync-*/
sudo mv imapsync /usr/bin/imapsync

Verify the installation:

$ imapsync -version
2.229

Prepare Gmail For email Migration

You need to create an app password to be used for the migration of emails. This can be done by logging in to your Gmail account, then, navigating to Security and searching App passwords as shown:

Migrate emails from GmailGoogle Gsuite to Zimbra 2

You need to create a new app password. Select the app as Mail from the drop-down menu and give it a custom name under device, select Other (Custom name)

Migrate emails from GmailGoogle Gsuite to Zimbra 3

Provide the name of the application:

Migrate emails from GmailGoogle Gsuite to Zimbra 4

Now generate the password and keep it safe for the next step.

Migrate emails from GmailGoogle Gsuite to Zimbra 5

Migrate emails from Gmail / Google Gsuite to Zimbra

Now after installing Imapsync, we can use it to sync emails from Gmail / Google Gsuite to Zimbra. We will begin by running a test using the command with the below syntax:

imapsync --host1 imap.gmail.com \
--user1 [email protected] \
--password1 your-google-app-password \
--host2 zimbra.domain.com \
--user2 [email protected] 
--password2 your-zimbra-password \
--syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude 'All Mail' --useheader 'Message-Id' --automap --skipemptyfolders --prefix1 '[Gmail]/' --dry --justfolders

In the above command, replace:

  • [email protected] with your Gmail username
  • your-google-app-password with the Google app password generated in the above step
  • zimbra.domain.com with your Zimbra domain
  • [email protected] with the Zimbra user account
  • your-zimbra-password password for the Zimbra account

Once domains and user credentials are correctly replaced, you will see this:

Migrate emails from GmailGoogle Gsuite to Zimbra 6

From the above output, you will see the messages to be synced, the size and several other resources. There are many other Imapsync flags. View the usage using the help command:

imapsync --help

Now perform the actual migration without the Dry run and just-folders options:

imapsync --host1 imap.gmail.com \
--user1 [email protected] \
--password1 your-google-app-password \
--host2 zimbra.domain.com \
--user2 [email protected] 
--password2 your-zimbra-password \
--syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude 'All Mail' --useheader 'Message-Id' --automap --skipemptyfolders --prefix1 '[Gmail]/'

You should have a similar output if all goes well.

Migrate emails from GmailGoogle Gsuite to Zimbra 7

On Zimbra, you will have the emails migrated as shown:

Migrate emails from GmailGoogle Gsuite to Zimbra 18

Once the email migrations are complete, remember to disable clear text login by navigating to Configure -> Global Settings -> IMAP as shown:

Migrate emails from GmailGoogle Gsuite to Zimbra 19

Import Contacts from Gmail / Google Gsuite to Zimbra

Another vital thing is importing contacts from Gmail / Google Gsuite to Zimbra. The above step will only sync email messages, but if you need contacts as well, then consider this step.

You need to export your Google contacts in the Outlook CSV format. Navigate to your Google contacts and select export as shown:

Migrate emails from GmailGoogle Gsuite to Zimbra 9

Select the format as Outlook CSV.

Migrate emails from GmailGoogle Gsuite to Zimbra 10

Save the file on your machine. Navigate to the Zimbra email client under Preferences -> Import/Export and import your CSV file.

Migrate emails from GmailGoogle Gsuite to Zimbra 11

If all is okay, you should see this:

Migrate emails from GmailGoogle Gsuite to Zimbra 12

Now you will have your contacts migrated from Gmail / Google Gsuite to Zimbra.

Verdict

That marks the end of this guide on how to migrate emails from Gmail / Google Gsuite to Zimbra. I hope you too managed to migrate your emails and contacts.

See more on this page:

LEAVE A REPLY

Please enter your comment!
Please enter your name here