Migration from IMAP source to Office 365

I. Pre-migration activities

This guide will help you migrate from any server supporting IMAP, e.g. IBM Notes, Zimbra, Google Workspace (G Suite), Zarafa, Kerio Connect and more. Before you install and configure CodeTwo Office 365 Migration, make sure that your environment (both the source and target server) is prepared for migration and that you meet the system requirements.

Below you will find the list of key points to be considered:

Step 1: Set up a custom domain in target Office 365

Add a custom domain to the target Office 365 tenant account and verify it.

Learn more about creating additional/custom domains in Office 365

Step 2: Assign licenses in Office 365

Make sure that Office 365 licenses are assigned to all user accounts that will be used as the target mailboxes. You can set the program to create the mailboxes and assign the Office 365 licenses automatically. Learn more

Alternatively, check out this article to learn about different ways of creating Office 365 mailboxes in bulk.


If you have already created new mailboxes in your target Office 365 tenant, it is possible to hide them from the GAL (e.g. to prevent your users from sending emails to them until the migration is finished). The mailboxes will be still visible in CodeTwo Office 365 Migration and the migration will proceed as usual.

Step 3: Prepare source IMAP server settings

Verify the following:

  • You have a list of all credentials for mailboxes you want to migrate via IMAP - here is why
  • Know your IMAP server address or IP, port and SSL connection support - for example, for Gmail those are: imap.gmail.com, port 993, enabled SSL
  • IMAP access is enabled on the source server - see here how to do this for Gmail and Google Workspace (formerly G Suite) accounts

Step 4: Install and activate CodeTwo Office 365 Migration

When migrating data from an IMAP server, the program can be installed anywhere, e.g. on a workstation outside source and target domains.

The following additional components will also be installed, as they are required for CodeTwo Office 365 Migration to run properly:

The installation wizard will guide you through the whole installation process. After the installation is finished, remember to activate the program

II. Migration process

The steps below will guide through the correct configuration of CodeTwo Office 365 Migration:

Step 1: Connect to the source server


Make sure that the software user who runs the migration is a local administrator.

Once you start the program, you will see the Dashboard view. Click Create a new migration job link on the How to start card. Select the source server type: IMAP. The create IMAP migration job wizard will open. Set the name of the job and click Next to proceed to the Source mailboxes step. If this is your first migration job, you will need to configure a connection to the source IMAP server. Click Add new source connection and a wizard will open. You need to go through these steps:

  • Server connection - in this step, you need to choose your IMAP source and some connection settings.
  • Throttling - there you can customize the software behavior if you stumble upon throttling issues on the IMAP source server.
  • Configuration - this process configures your connection based on the settings provided in the previous steps.

Step 2: Continue the job configuration to provide source mailboxes credentials

After successfully configuring the source connection, you will get back to the Source mailboxes step of the migration job wizard. Now you need to define which mailboxes you want to migrate.

  • Prepare a CSV file that contains source mailbox credentials as listed below. Do not worry that much about CSV format. CSV import feature lets you adjust the software to the file format used, e.g. you do not need to use a specific fields delimiter - use the one you like, you will be asked by the CSV import feature what kind of delimiter was used in the file.
    • Login - required
    • Password* - required
    • First Name - optional
    • Last Name - optional
    • Display Name - optional
  • Click Import CSV and select your CSV file.
  • Configure the software to properly import data from your CSV file.

* Or app password, if you are migrating from Google (Gmail or Google Workspace). Learn more

Step 3: Set the target connection

After successfully configuring the source connection and choosing source mailboxes, click Next to configure the target Office 365 connection. In the Target mailboxes step, choose Add new target connection from the Target server drop-down menu. A simple wizard will open:

  • Application registration – decide how you want CodeTwo Office 365 Migration to be registered in the Entra ID (Azure AD) of your target Office 365 tenant: automatically by the program (global admin account credentials will be required) or manually by yourself. If you select the second option, you will be asked to provide the application registration details in the next step.
  • Application details – enter the necessary application information. Additionally, you need to enter an email address of any user from your target Office 365 tenant. This account is used to gain access to the tenant's information, such as name, domain, etc. 
  • Configuration – this process registers CodeTwo Office 365 Migration in your Entra ID (if you have selected the Automatic registration option in the Application registration step) and configures the connection to the target Office 365 tenant.

Once the configuration ends successfully, you will see green check marks. If any errors appear, see Troubleshooting.

After your connection is established, click Finish and proceed to the next step (Match mailboxes).

Step 4: Match source and target mailboxes

Matching the source mailboxes with the target mailboxes can be done automatically, by using the built-in automatch feature, or manually. We suggest that you start off by matching mailboxes automatically and modify the automatch settings if not all the mailboxes were matched in the first run. Use the manual option only if there are any mailboxes left unmatched after several automatch runs with a different configuration of the automatch mechanism.

To match mailboxes automatically, click the Match mailboxes button. In the window that opens, click Automatch > Automatch all mailboxes or select the mailboxes you want to match and click Automatch > Automatch selected mailboxes. Configure the automatching mechanism and click Automatch to start the matching process. If not all the mailboxes were matched, modify the automatch mechanism and run it again. Repeat this as many times as necessary.

Read more about the default configuration of the automatch mechanism and how to customize it

If any source mailbox is left unmatched despite several attempts to match it automatically with different automatch settings, match it manually.

Note that you can set the program to create target users and mailboxes in your Office 365 tenant, whether you’re matching mailboxes manually or automatically. Learn more

When you have matched all your mailboxes, save your configuration and close the matching window. Continue with the migration job wizard. The next steps will allow you to configure additional options.

Step 5: Customize all necessary aspects of the migration job

You can configure the following additional options:

  • Scheduler - allows you to set the job to be automatically started in the desired time periods, so you do not have to control it manually.
  • Time filter - is used to exclude items that are older or newer than a particular date.
  • Folder filter - may completely exclude specific folders from the migration process.
  • Advanced settings - this step lets you define how many mailboxes should be migrated at the same time and set the maximum size of items to be migrated.

Step 6: Start the migration

Simply click Start on the ribbon to begin the process.


To speed up the migration, you should temporarily increase the EWS throttling policy limits in Exchange Online. Find out how to do so in this article.

The migration processing time depends on several different factors, e.g. the number of mailboxes and items, the speed of internet connection, etc.. We have published more details here

Step 7: Check if the number of migrated items in the Target mailbox folder corresponds to its equivalent on the Source server

If you notice any missing items in the Target mailbox restart the migration using the Run delta migration option.


Please be aware that the program does not migrate some specific folders at all. Those are i.e. Sync Issues or ones created while putting a mailbox on hold.


If any problems appear during the migration process, they will be indicated on the dashboard, pointed on the reports and logged in the log files. Check out the software's diagnostics.

Step 8: Check if there are not any new items in the Source mailbox after migration

Once the migration is finished and you have noticed that some new items appeared in the migrated Source mailbox, just restart the migration using the Run delta migration option. Please keep in mind that this feature migrates only new items, not the modified ones. Delta migration can also be used to resolve issues with any items that failed to migrate on the first attempt.

III. Post-migration cleanup

Once the migration is completed, please follow the points below:

Step 1: Change DNS records (MX, Autodiscover)

You need to change your MX records to enable mail flow to the new server.  Additionally, you should also set up Autodiscover record to facilitate connecting migrated mailboxes with a mail client (e.g. Outlook). To change these DNS records manually, follow the steps below:

  1. Log in to your Microsoft 365 admin center (Office 365 admin center).
  2. Go to Settings > Domains, select your domain and click DNS Management.
  3. Choose I’ll manage my own DNS records and click Next.
  4. Select Exchange checkbox and click Next.
  5. On this page, find the details regarding MX records and CNAME records (Autodiscover) that you need to use at your domain registrar. For specific instructions on how to configure DNS records in your domain registrar, visit this Microsoft page.
  6. Once the DNS records have been configured, click Verify back in Office 365. Please note that it may take several hours for the changes to propagate.


If any new items appear in a source mailbox while the MX records are being changed, it is possible to migrate these items after the records migration process is completed. It can be done via the Administration Panel of the program by choosing the Run delta migration option.

Step 2: (Optional) Disconnect domain

To avoid possible DNS conflicts, it would be a good idea to disconnect your domain name from the source IMAP server. Consult your domain name registrar in you need more information on how to do so.

IV. Troubleshooting

For troubleshooting information, refer to our Knowledge Base.

For additional resources, refer to Frequently Asked Questions or give us a call.

In this article

Was this information useful?