Sign In

Migrate Mails Using ImapSync

Updated Thursday, September 10, 2020

About ImapSync

ImapSync is a free and open source command line tool that can easily migrate messages from one IMAP account to another. It is a Perl script, written and maintained by Gilles Lamiral since 2001.

ImapSync logo

ImapSync is also offered as an online tool for a fee at https://imapsync.lamiral.info/X/

If you are tech savvy (and we believe you are if you are using Migadu), you can make the migration for free using the imapsync command line tool from your local computer.

ImapSync is easily scriptable, and you can use it to migrate multiple email accounts at once. It can be used for migrating your data into Migadu mailboxes as well out.

Please Donate

Gilles Lamiral makes his living by developing and supporting ImapSync. That has not prevented Gilles from making ImapSync free and open sourcing it with a very liberal license .

If you find ImapSync useful, please consider donating directly .

Installation & First Run

Please refer to official documentation on installing ImapSync.

Once installed, please get yourself familiar with ImapSync by running the imapsync command without any parameters. All parameters referring to the source or destination account are in the format --paramX where X is 1 for source and 2 for destination, e.g. --user1 and --user2.

Dry Run

Before running the migration, we recommend a dry run which will only describe the actions that would be taken, without actually moving any data.

In the example below, please change imap.source-server.com to your actual source IMAP server, account@source-domain.com to your actual source user name, imap.destination-server.com to your actual destination IMAP server and account@destination-domain.com to your actual destination user name.

In the example below, ImapSync will prompt you for the password without echoing it back. If you need to, you can include the --passwordX parameter to provide the password on the command line.

$ imapsync --dry \
  --host1 imap.source-server.com \
  --user1 account@source-domain.com \
  --ssl1 --sep1 . \
  --prefix1 ""  \
  --host2 imap.destination-server.com \
  --user2 account@destination-domain.com \
  --ssl2

By default, with SSL, the assumed port is 993. If you however need to use a different port, please use the --portX parameter.

If your IMAP server uses StartTLS (rare), you can use the --tlsX parameter.

For more options, please refer to the excellent built in documentation presented when running imapsync without any parameters.

Live Run

If all looks good, you can now remove the --dry parameter and actually run the migration.

$ imapsync \
  --host1 imap.source-server.com \
  --user1 account@source-domain.com \
  --ssl1 --sep1 . \
  --prefix1 ""  \
  --host2 imap.destination-server.com \
  --user2 account@destination-domain.com \
  --ssl2

If you have a lot of data, be prepared for this process to go on for hours if not days.

While you are waiting, it is probably the right time to ask yourself if you really need all that correspondence of years ago.

Gmail

To migrate data in or out of Gmail, special steps need to be made. Gmail by default disables simple IMAP access and option for less secure app access has to be enabled . Author of ImapSync created an overview of the necessary steps for usage with Gmail.

Needless to say, we discourage moving data into Gmail .