How to Migrate Accounts and Messages to Axigen via IMAP

 


Updated: December 13, 2021

 

The following article is a guide to migrating your email accounts and messages to Axigen via IMAP.

There are two ways of doing this, which we’ll cover in order:

  • Automatic migration
  • Manual migration using the Axigen Command Line Interface (CLI)

Solution

How to Perform Automatic Migration to Axigen

Connect to the Axigen WebAdmin interface and log in. In Axigen, you will have to create the domain you wish to migrate from the legacy mail server.

Next, navigate to Automatic Migration and click Enable in order to activate migration for the domain. Click on the Configure button and set:

  • The IP address of the legacy mail server. It must be enclosed between square brackets (e.g. [192.168.1.1] )
  • The SMTP and IMAP ports of the legacy mail server, ports on which this server accepts connections from Axigen's machine.
  • To save the settings, click the Quick Save button.

How Does Automatic Domain Migration Work?

When a domain has automatic migration enabled within Axigen and a user attempts to login to their account (via any of WebMail, IMAP, POP3), Axigen verifies if the account exists in its accounts storage. If it does, it considers the account already migrated and doesn't perform any special migration-related operation.

If the account doesn't exist, it will try to connect to an IMAP host at the IP address on the IMAP port you specified. When connecting, Axigen uses the exact same account credentials it received. If the credentials allow Axigen to login successfully, it will create the account with the same username and password as the ones previously used to log in and authenticate the user. It will also migrate the messages in this account via IMAP. This operation is equivalent to the one performed using the MIGRATE CLI command.

If the credentials are not correct, the account is not created and the user receives an authentication failure message.

The migrate operation will only work if the remote host has a working IMAP server.

On the SMTP side, if Axigen receives an email to an account from a migration-enabled domain and the account does not exist, it will relay the email to the legacy mail server. This way, space is saved by storing all the emails for the accounts that were not yet migrated, in the old MTA storage. The messages only get transferred to the Axigen storage when the user tries to login for the first time.

This mail relay operation to the legacy MTA storage will only work if the remote host has a working SMTP server.

1. When Axigen and the Legacy Mail Server Are Located on the Same Machine

If you have a mail server running on all interfaces, port 25, and the IMAP server running on all interfaces, port 143, you must first start Axigen, with SMTP-related services — SMTP Incoming and SMTP Outgoing — along with the IMAP service, disabled

Add the domain hosted by the legacy mail server, from which you want to migrate to Axigen.

For that domain, activate migration via WebAdmin, Automatic Migration, click the Configuration button, and set:

  • IP / Hostname: [127.0.0.1]
  • IMAP Port: 1430
  • SMTP Port: 2500

Set the legacy mail server services to listen on the following interface / ports:

  • SMTP service: 127.0.0.1:2500
  • IMAP service: 127.0.0.1:1430
  • Start the SMTP Incoming, SMTP Outgoing, and IMAP services — make sure that the respective service listeners are set to listen to the same interfaces as specified in the legacy mail server previous settings.

2. When Axigen and the Legacy Mail Server Are Located on Different Machines

Make sure that the Axigen machine's IP is visible with the legacy mail server's IP. In this example we will assume that the legacy mail server's IP is 192.0.2.1.

Add the domain hosted by the legacy mail server, from which you want to migrate to Axigen.

For that domain, activate migration via WebAdmin, Automatic Migration, click the Configuration button, and set:

  • IP / Hostname: [192.0.2.1]
  • IMAP Port: 143
  • SMTP Port: 25

For a better debugging of the migration process, it is recommended to set the CLI module with the logLevel attribute set to include 16 - protocol communication.

How to Perform Manual Migration Using CLI

Connect to the Axigen Command Line Interface (CLI), log in, and issue the following commands in the initial context:

UPDATE DOMAIN <domainname>
MIGRATE ACCOUNT <accountname> REMOTEHOST <host> REMOTEPORT <port> REMOTEUSER <imap-user> REMOTEPASS <imap-pass>

 

Additionally, there are five optional parameters you can add at the end of the MIGRATE command:

[ignoreFolders (folders)] [overrideQuota <yes|no>] [deleteOriginal <yes|no>] [structureOnly <yes|no>] [verbose <yes|no>]

 

In detail, the above parameters are:

  • <domainname> – the domain name for migration
  • <accountname> – the account name for migration
  • <host> – the host of the migration server. Use between square brackets if using an IP address (see note below)
  • <port> – the port of the migration server
  • <imap-user> – the IMAP username of the migration server
  • <imap-pass> – the IMAP password of the migration server
  • ignoreFolders (folders) – specifies a list of folders as displayed by LIST, separated by spaces, which will not be migrated
  • overrideQuota <yes|no> – specifies if the mailbox quota should be overridden (default: no)
  • deleteOriginal <yes|no> – enables / disables the deletion of all migrated messages on the remote server (default: no)
  • structureOnly <yes|no> – enables the migration of the directory structure only (default: no)
  • verbose – specifies if the command should be verbose (default: no)

The account to be migrated first needs to be created in Axigen.

For a better debugging of the migration process, it is recommended to set the CLI module with the logLevel attribute set to include 16 - protocol communication.

The square brackets are mandatory when using an IP address instead of an fully qualified hostname for the REMOTEHOST parameter. Omitting the square brackets will result in a failure result for the MIGRATE command.