Copy email from Gmail or Google Workspace to Hostsuar
imapsync copies the messages that Gmail or Google Workspace expose over IMAP to a destination mailbox you have already created. Check the copy before retiring the source; on its own it does not move calendars, contacts or account settings.
Google no longer accepts the normal account password for IMAP connections from applications that use basic authentication. To connect imapsync you need an app password or, for Google Workspace migrations, OAuth 2.0.
Migrate an account with an app password
- Go to Google Account security.
- Turn on 2-Step Verification if it is not already on.
- Open App passwords, create one for
imapsyncand copy the 16-character code. - Use that code, without spaces, as the source password in imapsync. The server is
imap.gmail.com, on port 993 with SSL/TLS.
App passwords may not be available if the organisation has turned them off, the account uses Advanced Protection or its 2-Step Verification settings do not allow them. Do not turn off 2-Step Verification or try the usual password instead.
In Google Workspace, the administrator must allow IMAP access for users. The old individual Enable IMAP switch is no longer available for these users.
Migrate several Google Workspace accounts
If you are moving a whole domain, do not generate and share one password per user. Use a service account with domain-wide delegation by following the guide Migrate Google Workspace email with imapsync and OAuth 2.0. The Workspace policy must allow any mail client for the organisational unit concerned; the mode that restricts IMAP to approved OAuth client IDs can block this delegation.
Revoke the app password or the OAuth authorisation as soon as you have verified the migration.
Check labels and scope before retiring Gmail
Gmail organises email with labels. A message can appear in several IMAP folders and the size counted at the destination may differ. Check the labels visible over IMAP, the messages in All Mail and Sent, and the folders the tool you use excludes.
For a personal @gmail.com account, copying the history to Hostsuar does not transfer that address or make its future messages arrive automatically in the new mailbox. For Workspace with your own domain, changing the MX records is a separate stage that you should prepare after verifying the accounts.
Start with an authentication test and one mailbox. If Google temporarily limits downloads, keep the log and resume when appropriate; do not delete messages from the source to try to speed up the copy.
You may also find useful
- Migrate Google Workspace email with imapsync (OAuth2 service account) Explains in detail how to authorise imapsync across a whole Google Workspace domain with OAuth2, a s...
- Migrate your email without losing messages when you change provider How to prepare the mailboxes, make a first copy, synchronise the final messages and move your email...
- Use imapsync over SSH to copy email between providers Shows how to copy a whole mailbox with imapsync over SSH, using TLS and protected files for the cred...
- Save your email to your computer before deleting it from the server Compare a local archive, POP download and backup, and check messages and attachments before freeing...
Something wrong or out of date? Tell us and we will review it.