我部署了许多 Google Apps帐户,并多次使用imapsync将帐户迁移到Google Apps。
然而,这一次,不pipe我尝试imapsync拒绝工作,声称我的凭据是不正确的 – 我已经检查了他们一次又一次,他们是100%正确的。
在从源代码构build的Ubuntu 12上,我的命令是:
imapsync --host1 myserver.com --user1 [email protected] --password1 mypassword1 -ssl1 --host2 imap.gmail.com --user2 [email protected] --password2 mypassword2 -ssl2 -authmech2 PLAIN
命令的完整输出:
get options: [1] PID is 21316 $RCSfile: imapsync,v $ $Revision: 1.592 $ $Date: With perl 5.14.2 Mail::IMAPClient 3.35 Command line used: /usr/bin/imapsync --debug --host1 myserver.com --user1 [email protected] --password1 mypassword1 -ssl1 --host2 imap.gmail.com --user2 [email protected] --password2 mypassword2 -ssl2 -authmech2 PLAIN Temp directory is /tmp PID file is /tmp/imapsync.pid Modules version list: Mail::IMAPClient 3.35 IO::Socket 1.32 IO::Socket::IP ? IO::Socket::INET 1.31 IO::Socket::SSL 1.53 Net::SSLeay 1.42 Digest::MD5 2.51 Digest::HMAC_MD5 1.01 Digest::HMAC_SHA1 1.03 Term::ReadKey 2.30 Authen::NTLM 1.09 File::Spec 3.33 Time::HiRes 1.972101 URI::Escape 3.31 Data::Uniqid 0.12 IMAPClient 3.35 Info: turned ON syncinternaldates, will set the internal dates (arrival dates) on host2 same as host1. Info: will try to use LOGIN authentication on host1 Info: will try to use PLAIN authentication on host2 Info: imap connexions timeout is 120 seconds Host1: IMAP server [SERVER1] port [993] user [USER1] Host2: IMAP server [imap.gmail.com] port [993] user [USER2] Host1: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready. Host1: SERVER1 says it has CAPABILITY for AUTHENTICATE LOGIN Host1: success login on [SERVER1] with user [USER1] auth [LOGIN] Host2: * OK Gimap ready for requests from MY-VPS Host2: imap.gmail.com says it has CAPABILITY for AUTHENTICATE PLAIN Failure: error login on [imap.gmail.com] with user [USER2] auth [PLAIN]: 2 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
我已经尝试了-authmech2 LOGIN以及返回:
Host2: imap.gmail.com says it has NO CAPABILITY for AUTHENTICATE LOGIN Failure: error login on [imap.gmail.com] with user [[email protected]] auth [LOGIN]: 2 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
如果有人能够对此有所了解,我将不胜感激。
仔细检查证书,所以给它一个200%的检查。 按照Janne的build议,通过标准客户端(如Thunderbird或Outlook)或手动(请参见下文)检查凭据。
注意用密码中的特殊字符引用问题,使用围绕“密码”和“用户值”的单引号。
imapsync ... --password2 'secret'
其他的一点,–authmech2 PLAIN或–authmech2 LOGIN现在已经没有用,因为默认情况下imapsync已经使用了它们。 如果login与传统的电子邮件客户端一起工作,那么它明确表示这是值中的字符/引用问题。 你可以用ncat或者telnet-ssl来检查一个手动的login,就像这个例子(客户端的input部分是“LOGIN …”,然后是“b LOGOUT”):
ncat --ssl -C imap.gmail.com 993 * OK Gimap ready for requests from 78.196.254.58 q1mb175739668wix a LOGIN "[email protected]" "secret" * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST... ESEARCH a OK [email protected] Gilles Lamiral authenticated (Success) b LOGOUT * BYE LOGOUT Requested b OK 73 good day (Success)
如果有奇怪的字符,也可以尝试更改密码。
在遇到同样的问题之后,我打开了“Access for less secure apps”解决了这个问题。
https://www.google.com/settings/security/lesssecureapps?pli=1
我和Larch有同样的错误
我的(工作)imapsync设置使用--authmech2 LOGIN为连接的GMail端。 我记得在命令行传递密码时遇到问题,所以我切换到从文件中读取密码:– --passfile2 /path/to/imapsecret2
我的Fedora 20打包的imapsync报告了以下模块:
Mail::IMAPClient 3.35 IO::Socket 1.36 IO::Socket::IP 0.30 IO::Socket::INET 1.33 IO::Socket::SSL 1.955 Net::SSLeay 1.55 Digest::MD5 2.53 Digest::HMAC_MD5 1.01 Digest::HMAC_SHA1 1.03 Term::ReadKey 2.30 Authen::NTLM 1.09 File::Spec 3.40 Time::HiRes 1.9726 URI::Escape 3.31 Data::Uniqid 0.12
它报告与GMail的连接如下所示:
Host2: imap.googlemail.com says it has NO CAPABILITY for AUTHENTICATE LOGIN Host2: success login on [imap.googlemail.com] with user [user@googleappsdomain] auth [LOGIN]
另一个阻碍问题是,我不得不添加帐户迁移到标准的电子邮件客户端(雷鸟)。 一旦我添加帐户,并在雷鸟打开它,imapsync工作。