1 (edited by gpapaiko 2022-06-06 19:56:58)

Topic: IMAPSYNC with gmail account

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,

I am trying to use imapsync to move my emails from the gmail /g-suit/ Google Workspace/ to iredmail but have had no luck it seems to be failing with the gmail login.

This is the command I am using:
imapsync \
--syncinternaldates \
--subscribeall \
--host1 imap.gmail.com \
--authmech1 LOGIN \
--port1 993 \
--ssl1 \
--gmail1 \
--user1 xx@icednetworks.com \
--password1 xx@32 \
--authuser1 xx@icednetworks.com \
--folderlast  "[Gmail]/All Mail" \
--host2 127.0.0.1 \
--user2 xx2@icednetworks.com \
--password2 xx22@32 \
--noauthmd5 \
--automap \
--maxsleep 2 \
--synclabels \
--resynclabels \
--allowsizemismatch \
--exclude 'Trash|Spam' \
--debugssl  4 \
--dry

and it fails:
...
Err 1/1: Host1 failure: Error login on [imap.gmail.com] with user [xx@icednetworks.com] auth [LOGIN]: 2 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
....

It connects to the local mail server but fails with gmail.

Any help is welcomed, I have read others have done it successfully, but mine seems to be failing.

Thanks in advance.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: IMAPSYNC with gmail account

if you have certain special characters in the password you may need to escape them - xx\@32 for instance. I can't say for sure which ones, but I have had to escape # and $. I haven't used imapsync with gmail, but I use it to transfer files when I'm changing our own mail servers.

3

Re: IMAPSYNC with gmail account

Gmail and Google Apps use XOAUTH2 for auth.

#   *) For Gmail and Google Apps:
#
#       * they requires XOAUTH2 for authentication, plain or login mech are NOT
#         supported.
#       * use `--host1 imap.gmail.com -ssl1 --authmech1 xoauth2` instead of
#         tls.
#       * `--password1` format: 'email;key_file'.
#
#           - `email` is email address of Google Developer service account.
#           - `key_file` is path to the P12 key file generated for the Google
#             Developer service account.

References:
- https://developers.google.com/identity/ … iceAccount
- Gmail auth scopes: https://developers.google.com/gmail/api/auth/scopes