Home » Blog » IMAP » How to Migrate IMAP to Office 365 Account – A Comprehensive Guide

How to Migrate IMAP to Office 365 Account – A Comprehensive Guide

Published By Nilesh Kumar
Debasish Pramanik
Approved By Debasish Pramanik
Published On August 28th, 2023
Reading Time 6 Minutes Reading
Category IMAP

When it comes to IMAP to Office 365 migration, the methods dwindle down to only three in number. It’s either using EAC, PowerShell, or Professional software. After all, there is a qualitative difference between the normal IMAP accounts and Microsoft 365 service.

In this guide, we will discuss two solutions to migrate IMAP to Office 365 account:

  1. Using PowerShell commands
  2. Using a Professional Tool

So, let us start with the methods now.

How to Migrate IMAP to Office 365 Using PowerShell Scripts?

There are six major steps involved in this IMAP migration. Make sure to perform them all accurately to get the intended results.

Consider these restrictions before migration:

  • Only migrate emails.
  • Do not migrate contacts, calendars, or tasks.
  • Migrates 500,000 items from one user mailbox
  • Skips messages with size exceeding 35 MB.

Now, let us go through the actual steps to migrate IMAP emails to Office 365 accounts.

Step 1 – Preliminary preparation for the IMAP migration

  • Add the IMAP organization domain as the accepted domain to Microsoft 365
  • Add users to Microsoft 365
  • Acquire the fully qualified domain name of the IMAP server
  • Make sure the firewall allows IMAP connections
  • Assign permissions so that the admin account can access all IMAP mailboxes
  • Sign in to the local Windows PowerShell session and import cmdlets
  • Test connection to the IMAP server with this command – Test-MigrationServerAvailability –IMAP –RemoteServer <FQDN of IMAP server> -Port <143 or 993> -Security <None, SSL, or TLS>

Step 2 – Create a CSV file

The next step is to create a CSV file that contains the list of users whose mailboxes you want to migrate to Office 365 accounts. The list contains information in this format:





Step 3 – Create an endpoint for IMAP to Office 365 migration

The purpose of the migration endpoint is to connect and communicate with the IMAP source system. To create this endpoint, first, connect to Exchange Online PowerShell.

Then, run the following command in it:

New-MigrationEndpoint -IMAP -Name IMAPEndpoint -RemoteServer imap.cont.com -Port 993 -Security SSL

To verify that it’s working, execute the following command which will display the relevant information:

Get-MigrationEndpoint IMAPEndpoint | Format-List EndpointType,RemoteServer,Port,Security,Max*

Step 4 – Create a migration batch and run it

The cmdlet New-MigrationBatch is used to create a batch and run it automatically with the AutoStart parameter. Another way is to first create a batch without the parameter, and then run it with the Start-MigrationBatch parameter. The command is as follows:

New-MigrationBatch -Name IMAPBatch1 -SourceEndpoint IMAPEndpoint -CSVData ([System.IO.File]::ReadAllBytes(“C:\Users\Administrator\Desktop\IMAPmigration_1.csv”)) –AutoStart

Step 5 – Route the future emails to Microsoft 365

MX record is something that every email system has to point to the delivery location. By changing this MX record to point to Office 365, you can make sure that all future emails are delivered to Office 365 accounts. Thus, your current emails are migrated via the migration batch while the emails received in the future are also moving toward the Office 365 account.

Every DNS provider has different ways to change the MX record. Once you execute them, make sure to wait for 72 hours before the next step.

Step 6 – Delete the migration batch

Now that all emails are successfully moved and the MX record is already pointing towards Microsoft 365, it is time to delete the migration batch:

Remove-MigrationBatch -Identity IMAPBatch1

Verify that it’s deleted by executing this command:

Get-MigrationBatch IMAPBatch1

If it returns a removing status, then the deletion is being carried out and if it displays an error, then the batch is no longer present.

This ends the six steps to migrate IMAP to Office 365 manually. It is clear that this is a complex process and needs a certain technical expertise to get the job done. So, we have another method here that is much easier to understand and execute even by the standards of a normal user.

Note: Another way to import IMAP to Office 365 account is to convert IMAP to PST, then import PST to Office 365. However, the complexity will remain the same since the second phase is quite demanding.

Professional IMAP to Microsoft 365 Migration Method

The IMAP Migration tool, recommended by experts, is the best way to migrate IMAP emails to Microsoft 365 accounts. It has an easy-to-use graphical interface which eliminates the need for technical expertise and hence is well received by thousands of users worldwide.

Of course, since it involves cloud computing, there are prerequisites to follow before the migration process. But these are easy to handle and our support team can help you complete them within minutes.

Download the free trial version here that allows migration of 2 email accounts only. For complete benefits, activate the licensed version.

How Does the Tool Work?

Step 1. Start the IMAP to Office 365 migration tool and select IMAP and Office 365 as Source and Destination respectively.

Step 2. After that, select Email and apply the date-range filter on the emails that you wish to migrate if required.

Step 3. In the next window, choose the appropriate IMAP Server option and fill in the incoming URL and port number (example – imap.gmail.com and 993 for Gmail).

Step 4. Then, validate the read and write permissions enabled in the pre-requisites.

Step 5. In the next window, input the Office 365 admin ID and app ID and validate the permissions here as well.

Step 6. Now, import the list of user accounts to migrate via a CSV file. The template is provided on this screen itself.

Step 7. Finally, validate the source and destination email accounts and click the Start Migration button.

Step 8. Voila, the migration started successfully. Wait till it ends and you have the migration report in your hands.

Step 9. This concludes the steps to migrate emails from IMAP to Office 365 account.

Wrapping Up

After going through the article, it is safe to say that IMAP migration is faster and easier when executed with a professional solution. After all, it removes complications and lets you deal with only the mapping of the IMAP and Microsoft 365 accounts. But, if you have the expertise, you are welcome to try out the manual method. In the end, completing the migration successfully is what matters the most.


By Nilesh Kumar

As a Chief Technical Writer, I know the technical issues faced by home and professional users. So, I decided to share all my knowledge via this blog. I love to help you with challenges while dealing with technical jargon.