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
- Login to your Administraton interface (By default port 7071, username admin) and go to Configuration -> Global Settings -> IMAP and enable "Enable clear text login."
- 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
- 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
- Install EPEL repository
- yum install -y epel-release
- Install ImapSync
- yum install -y imapsync
- 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
- 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
- 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
- Login to your Administraton interface (By default port 7071, username admin) and go to Configuration -> Global Settings -> IMAP and enable "Enable clear text login."
- 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
- 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
- Open Google API console at https://console.cloud.google.com/home/dashboard Login with GSuite Administrator credentials
- Create new project using API Project -> Create Project -> ProjectName -> Create
- Create Service Account using: Google Cloud Platform --> IAM & Admin --> Service accounts --> Create Service account
- Enter ServiceAccountName such as "NewServiceAccount"
- Choose role as "Project-->Owner"
- Select "Furnish a new private key"
- Select "p12"
- Select "Enable G Suite Domain-wide Delegation"
- Create
- Download and save private Key
- 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
- Open Security tab and go to Google Admin -> Security -> Advanced Settings -> Manage API Client Access. Enter Client ID against client name.
- Select one or More API Scopes "https://mail.google.com/"
- Select "Authorize"
Install ImapSync on CnetOS 7
- Install EPEL repository
- yum install -y epel-release
- Install ImapSync
- yum install -y imapsync perl-LWP-Protocol-https
- 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
- https://support.google.com/a/answer/6260879?hl=en
- http://www.vionblog.com/migrate-google-apps-to-zimbra/
- https://www.limilabs.com/blog/oauth2-gmail-imap-service-account
Home > CentOS > CentOS 7.x > Email configuration > Zimbra configuration > CentOS 7.x Migrate emails from Google GSuite to Zimbra