=======================================================================
Q. Can I use imapsync to transfer from or to Gmail accounts?

A. Yes. The IMAP access to a Gmail account is not always allowed
by default so here is how to allow IMAP for a Gmail account:
-> Do not go to "Manage your Google Account" (the upper right icon with your Google face)
-> Instead, go to Gmail at https://mail.google.com/
-> Click on Settings, the gear button on the upper right of Gmail.
-> Click on "See all settings" at the top of the pull down menu.
-> Go to the tab "Forwarding and POP/IMAP"
-> Go down to "IMAP Access"
-> Activate the radio button "Enable IMAP"
-> Click on the button "Save changes" at the bottom of the page.

That's not finished, there is also the authentication issue to consider.
There are three different ways to authenticate to Gmail with Imapsync,
either:

1. "App password with 2-step verification", which is currently the
   only way to authenticate on Gmail with the imapsync online service
   https://imapsync.lamiral.info/X/
   An app password is only available for an individual account.

2. OAUTH2 for individual Gmail authentication, see
   https://imapsync.lamiral.info/oauth2/oauth2_imap/README_oauth2.txt

3. for Gmail groups, on any OS, see
   https://imapsync.lamiral.info/FAQ.d/FAQ.XOAUTH2.txt

Back to
1) So, how to setup an "app password" on Gmail?

Short answer: first, you have to activate "2-step verification".
Then, once activated, "2-step verification" will allow you to generate
an "App password" at https://myaccount.google.com/apppasswords

Now, the details.
Go to
https://myaccount.google.com/security
and sign in with the account you want to transfer email to or from.
Go to the "Signing in to Google" part of the security page and follow
the process to activate the "2-step verification", until it is ok.

Then, in the part "How you sign in to Google" click on the "2-step
verification" line. There, at the bottom of the page, you will be
proposed to generate an "App passwords".

As an alternative, you can also go to
https://myaccount.google.com/apppasswords
it will bring you at the same place.

Then, follow the instructions to get a 16 characters password. On the
pull-down button "Select app", choose "Other (Custom name)" and call
it imapsync for example. The name doesn't matter. Now, use this
password to access the mailbox with imapsync. If you copy/paste the
password, remove the blanks inside the password, the blanks are not
part of the password, they're just there to facilitate the reading but
they're bad to authenticate with imapsync. If you leave the blanks,
you may encounter an authentication error.

The following document details what I've just described and other
useful tips about app passwords:
https://support.google.com/accounts/answer/185833?hl=en

Even if Google says "Every App Password is only used once", it's false
and the same password can be used many times.

Here is another document about Gmail app passwords, more graphical:
https://www.limilabs.com/blog/using-app-passwords-with-gmail

Other questions related to Gmail and imapsync at
https://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt

=======================================================================