Email

Move your email from Gmail to Hostsuar with imapsync (app password)

Reviewed on 3 min read email migration imapsync Gmail

To copy email from an external account to our servers we use imapsync, a tool that connects to both accounts over IMAP and copies every message and folder without losing anything.

With Gmail there is one step to prepare first: Google does not accept the account's normal password for IMAP connections from programs such as imapsync. You need an app password.

Create the app password

  1. Go to your Google Account security.

  2. Check that 2-Step Verification is turned on. If it is not, turn it on: without it, app passwords do not appear.

    2-Step Verification in Google Account security

  3. Open App passwords, type a name (for example, imapsync) and click Create.

  4. Google will show you a 16-character password. Copy it: this is what you will use in imapsync, without spaces, as the Gmail account's password.

The Gmail connection settings are:

  • IMAP server: imap.gmail.com
  • Port: 993, with SSL/TLS
  • Username: your full Gmail address
  • Password: the app password

IMAP access is always on in Gmail; you no longer need to enable it in Gmail's settings.

If the app passwords option does not appear, it may be because you use Google's Advanced Protection or, in Google Workspace, because the administrator has turned them off. In Workspace, the administrator must also allow IMAP access for users from the Admin console.

Once you have checked that the migration is complete, delete the app password from the same page.

Migrate many Google Workspace accounts

If you are moving a whole domain, creating one app password per user is slow. It is better to use a service account with OAuth 2.0, which gives access to every mailbox in the domain: you have it step by step in migrate Google Workspace email with imapsync and OAuth 2.0.

After the copy: Gmail labels

Gmail does not use folders but labels, and a message with several labels appears over IMAP in several folders. That is why your email may take up more space at the destination than in Gmail. When the copy finishes, check that you have the Inbox, Sent and your labels.

Copying your email does not change where new email arrives:

  • If it was an @gmail.com account, it will keep receiving email in Gmail. Tell your contacts your new address or set up forwarding in Gmail, under Settings > See all settings > Forwarding and POP/IMAP > Add a forwarding address.
  • If it was Google Workspace with your own domain, once you have checked the copy you will need to change the MX records so that new email arrives at Hostsuar. Then run imapsync once more to copy anything that reached Gmail in the meantime.

You may also find useful

Something wrong or out of date? Tell us and we will review it.