CentOS 7.x Migrate emails from Google GSuite to Zimbra

From Notes_Wiki

Home > CentOS > CentOS 7.x > Email configuration > Zimbra configuration > CentOS 7.x Migrate emails from Google GSuite to Zimbra

Migrate individual email accounts

Prepare Zimbra Server for email migrataion

  1. Login to your Administraton interface (By default port 7071, username admin) and go to Configuration -> Global Settings -> IMAP and enable "Enable clear text login."
  2. Change maximum size of upload file at Configuration -> Global Settings -> General Information with option "Maximum size of an uploaded file for Briefcase, Email messages, Calendar appointments and Tasks" to 25600 KB. This is required as Gmail might have emails of size 25MB which is not allowed by Zimbra by-default.


Prepare G Suite for email migration

  1. In G Suite admin dashboard, Enable/Enforce access to less secure apps for all users by Admin console -> Security -> Basic settings. Select "Enforce access to less secure apps for all users"


Install ImapSync on CentOS 7

  1. Install EPEL repository
    yum install -y epel-release
  2. Install ImapSync
    yum install -y imapsync
  3. ImapSync test run to check whether passwords, hostnames, imapsync, network, etc. are working properly or not
    imapsync --host1 imap.gmail.com --user1 user@gmail.com --password1 Gmail-Password --host2 zimbra.domain.com --user2 user@zimbradomain.com \
    --password2 Zimbra-Password --syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude All Mail \
    --useheader 'Message-Id' --dry --justfolders
  4. If test is successful then actually sync mailboxes using
    imapsync --host1 imap.gmail.com --user1 user@gmail.com --password1 Gmail-Password --host2 zimnra.domain.com --user2 user@zimbradomain.com \
    --password2 Zimbra-Password --syncinternaldates --ssl1 -ssl2 --noauthmd5 --split1 100 --split2 100 --exclude All Mail \
    --useheader 'Message-Id'


Contact export

  1. To export Contacts use Gmail export as Outlook CSV option and then import into outlook or other desktop email application. You can also import contacts to Zimbra using https://www.zimbra.com/desktop7/help/en_US/Contacts/Importing_Contacts.htm



Migrate all accounts using admin credentials

If an entire GSuite domain is being migrated to Zimbra then the same can be achieved with help of admin credentials as follows:

Prepare Zimbra Server for email migrataion

  1. Login to your Administraton interface (By default port 7071, username admin) and go to Configuration -> Global Settings -> IMAP and enable "Enable clear text login."
  2. Change maximum size of upload file at Configuration -> Global Settings -> General Information with option "Maximum size of an uploaded file for Briefcase, Email messages, Calendar appointments and Tasks" to 25600 KB. This is required as Gmail might have emails of size 25MB which is not allowed by Zimbra by-default.


Prepare G Suite for email migration

  1. In G Suite admin dashboard, Enable/Enforce access to less secure apps for all users by Admin console -> Security -> Basic settings. Select "Enforce access to less secure apps for all users"


Create service account in Google API Console

  1. Open Google API console at https://console.cloud.google.com/home/dashboard Login with GSuite Administrator credentials
  2. Create new project using API Project -> Create Project -> ProjectName -> Create
  3. Create Service Account using: Google Cloud Platform --> IAM & Admin --> Service accounts --> Create Service account
    1. Enter ServiceAccountName such as "NewServiceAccount"
    2. Choose role as "Project-->Owner"
    3. Select "Furnish a new private key"
    4. Select "p12"
    5. Select "Enable G Suite Domain-wide Delegation"
    6. Create
  4. Download and save private Key
  5. Get client ID & service account details using Google Cloud Platform --> IAM & Admin --> Service accounts --> View Client ID


Add API details in G Suite security details

  1. Open Security tab and go to Google Admin -> Security -> Advanced Settings -> Manage API Client Access. Enter Client ID against client name.
    1. Select one or More API Scopes "https://mail.google.com/"
    2. Select "Authorize"


Install ImapSync on CnetOS 7

  1. Install EPEL repository
    yum install -y epel-release
  2. Install ImapSync
    yum install -y imapsync perl-LWP-Protocol-https
  3. Run below command for migration of one individual account
    imapsync --host1 imap.gmail.com --authmech1 xoauth2 --user1 user-account@gmail.com \
    --password1 'gmailapizimbra gmailapizimbra@api-project-164309.iam.gserviceaccount.com;API-Project-7e89bdd21f87.p12' \
    --host2 zimbra.gbb.com --noauthmd5 --user2 user-account@zimbradomain.com --authuser2 admin@zimbradomain.com \
    --password2 Zimbra-admin-password --syncinternaldates --ssl1 -ssl2 -split1 100 --split2 100 --exclude All Mail \
    --useheader 'Message-Id'
    We can use the above command by replacing user-account@gmail.com and user-account@zimbradomain.com with different IDs for every run to migrate all accounts one-by-one.


Refer


Home > CentOS > CentOS 7.x > Email configuration > Zimbra configuration > CentOS 7.x Migrate emails from Google GSuite to Zimbra