How to test IMAP connectivity for migration purposes
You need to test IMAP connectivity between the machine that runs CodeTwo migration software (or is located within the same LAN segment) and your actual IMAP server.
To check if it is possible to establish an IMAP connection between your source IMAP server and the machine used to perform the migration, you need to test the connection manually by using either the SSL or non-SSL port. Depending on the connection type, you will need to use a different tool to perform the test. Once the connection is established, you will need to authenticate with username and password of any source user and eventually list all the folders from that user’ mailbox.
Perform the steps provided below to test IMAP connectivity in your environment:
- Connect to an IMAP server over SSL (recommended) or
Connect to an IMAP server over an unsecured port (not recommended)
- Authenticate to an IMAP server
- Listing folders of an IMAP account
Connecting to an IMAP server over SSL
This is the most recommended way of testing the IMAP connectivity. As with most production migrations, you should always be using the SSL connection to make sure that all transferred data is correctly secured on its way. In order to test the connection, you need to use any OpenSSL implementation on your migration machine. We recommend using the following OpenSSL Installer for Windows.
Once installed, you can run it and execute the following command.
s_client -connect [IP address or hostname]:[port]
as shown in Fig. 1.
Note that in most cases the default SSL port used for secure IMAP connections is 993.
Fig. 1. Connecting to an IMAP server from a Windows-based computer.
If the connection has been successfully established, you will receive the same notification as shown in Fig. 2.
Fig. 2. An IMAP connectivity test passed successfully.
If you prefer to test the connection by using a UNIX-like machine from inside your network, you need to use full syntax, including calling the openssl client (Fig. 3.).
openssl s_client -connect [IP address or hostname]:[port]
Fig. 3. Connecting to an IMAP server from a UNIX-based platform.
If the connection has been successfully established, you will receive the same notification as shown in Fig. 4.
Fig. 4. Connected successfully to an IMAP server from a UNIX-based platform.
If you were able to successfully connect to your IMAP server, proceed to the Authenticating to an IMAP server step.
However, if you were not able to establish a connection, you should try performing the test from another network segment or a different network, and also check your security measures, including hardware and software firewalls above all. The inability to connect to an IMAP server means that it is not possible to perform the migration using CodeTwo software due to your environment’s configuration. You can also consider connecting to a non-SSL port instead, although this is not recommended.
Connecting to an IMAP server over an unsecured port (not recommended)
All information sent to and from an IMAP server over a non-protected (non-SSL) port can be easily intercepted by third parties during the transmission. That is why continuing the migration via an insecure connection should be used only as a last resort, and only if the network in which the migration machine (the one on which the CodeTwo migration software is installed) and the actual IMAP server reside is "local only", with no external access.
In order to test the IMAP connectivity, you can use telnet, which is available on all operating systems. If the telnet feature is not enabled on your Windows machine, you need to install it before continuing with the steps below.
The telnet client requires you to input the server name or IP address and the IMAP connection port (which is usually 143), as shown in Fig. 5.
telnet [IP address or hostname] [port]
Fig. 5. Establishing an insecure IMAP connection.
Authenticating to an IMAP server
If you were able to connect to your IMAP server, you should now try to authenticate (log in) to it by using credentials (username and password) of any of your IMAP server users. You are going to send the authentication data directly, with no additional encryption, using the command below:
A1 LOGIN [username] [password]
Once you run this command, the IMAP server will try to get you through. If the credentials are correct, you will receive the A1 OK message (as shown in Fig. 6.), which means you are now successfully logged. You should now try listing folders of the authenticated IMAP account.
Fig. 6. Authentication success.
If the authentication fails, your IMAP server will send back the A1 NO message (Fig. 7.). In such case you need to double check whether:
- you have used the right password, including all special characters,
- you have used the right username (try using the full email address, e.g. [email protected]),
- if you have copied the password directly from a CSV file, make sure the file has been saved using an encoding accepted by your IMAP server (if the server accepts UTF-8, the CSV file should also be saved with UTF-8 encoding).
Fig. 7. Authentication failed.
Listing folders of an IMAP account
The last step of the IMAP connectivity test is to check whether all mailbox folders can be listed correctly. It may happen that a particular folder name contains invalid characters and will not be listed. This could directly cause your migration job to fail.
To list all folders of an IMAP account, you first need to authenticate with this account’s credentials, as described here. Once you're logged in, execute the command below:
A1 LIST * *
If the command succeeds, you will receive a list of all folders from the logged in IMAP account (Fig. 8.).
Fig. 8. The entire IMAP connectivity test completed successfully.
|Related products:||CodeTwo Exchange Migration, CodeTwo Office 365 Migration|
|Last modified:||November 5, 2021|
|Created:||June 23, 2021|