Skip to content

Migrating existing emails to Gmail CSE

This documentation focuses on migrating email messages from a PST or Mbox archive to Gmail CSE. An overview of all migration options is provided in this blog article and covers other options such as migrating from Virtru or Microsoft Exchange.

A more general view of all the migration options to and from Gmail can be found at this link

Install the migration utility

Download the migration utility from the first link above.

Make sure you look at the included readme file for the scopes that must be associated with the service account (see below).

Create a service account credential with domain-wide access

Head to the GCP console and follow the Google Documentation on creating a Service Account

Create a service account

service account creation
Figure 1: service account creation

Create a key in JSON format

create a service key
Figure 2: create a service key

The key will be saved to your computer. The key will be provided to the migration utility.

Grant the GMail API domain-wide access

Open the Google Workspace Admin and follow the instructions in the paragraph Set up domain-wide delegation for a client

api_controls
Figure 3: api_controls

Create a new API client, the client ID is available in the Details of the service account client id on the Google Cloud Console.

The OAuth scopes required are:

  • https://www.googleapis.com/auth/gmail.readonly for a dry run

  • https://www.googleapis.com/auth/gmail.modify when performing the actual migration

For more details on Google OAuth scopes, check this reference

Migrate : example usage

Perform a dry-run over two input files to verify that they can be parsed and that their messages can be encrypted in preparation for migration:

For Windows:

gmail-cse-migrate.exe -input user1.pst -input user2.pst -api-credential c:\my_svc_acct.json -dryrun -logfile log.txt

If it looks good, then run the command again in migration mode:

gmail-cse-migrate.exe -input user1.pst -input user2.pst -api-credential c:\my_svc_acct.json -logfile log.txt

For macOS:

/gmail-cse-migrate \
   -api-credential=./gmail-migration-service-account-key.json \
   -input=user1.mbox \
   -logfile=./log.txt -dryrun

Version: gmail_cse_migrate-24.11.0.2 (darwin)
Download URI:
  https://dl.google.com/clientsideencryption/gmail-cse-migrate/macos/latest/gmail-cse-migrate.dmg


COMPLETED
  Inspected: 1 file in 0 directories
  Found:     163 messages in 1 .mbox file
  Failures:  6 messages in .mbox files failed to parse

MIGRATION
  Processed: 127 messages
  Skipped:   127 messages were not uploaded due to dryrun
  Skipped:   36 already encrypted messages were not migrated

PARTIAL SUCCESS

LOG FILE WRITTEN TO
  ./log.txt

Export Data from GMail

If you need to export data from Gmail, the easiest is to use TakeOut, which you can find here

To export data for a single user, follow this documentation

To export the whole organization data, follow this documentation

© Copyright 2018-2024 Cosmian. All rights reserved.