我正在尝试设置OfflineIMAP以将我的Gmail帐户同步到~/Mail/Gmail
。我~/.offlineimaprc
从这里开始使用一个非常基本的东西。但是OfflineIMAP根本无法连接到Gmail。这是我得到的调试消息(通过将OfflineIMAP运行为offlineimap -o -d imap
:
OfflineIMAP 6.3.4
Copyright 2002-2011 John Goerzen & contributors.
Licensed under the GNU GPL v2+ (v2 or any later version).
Debug mode: Forcing to singlethreaded.
Now debugging for imap: IMAP protocol debugging
Now debugging for : Other offlineimap related sync messages
Account sync Gmail:
***** Processing account Gmail
Copying folder structure from IMAP to Maildir
Establishing connection to imap.gmail.com:993.
DEBUG[imap]: 06:28.69 Account sync Gmail imaplib2 version 2.24
DEBUG[imap]: 06:28.69 Account sync Gmail imaplib2 debug level 5, buffer level 3
WARNING: Error occured attempting to sync account 'Gmail':
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/offlineimap/accounts.py", line 177, in syncrunner
self.sync()
File "/usr/lib/pymodules/python2.7/offlineimap/accounts.py", line 235, in sync
remoterepos.syncfoldersto(localrepos, [statusrepos])
File "/usr/lib/pymodules/python2.7/offlineimap/repository/Base.py", line 124, in syncfoldersto
srcfolders = src.getfolders()
File "/usr/lib/pymodules/python2.7/offlineimap/repository/IMAP.py", line 276, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/pymodules/python2.7/offlineimap/imapserver.py", line 323, in acquireconnection
elif isinstance(e, socket.error) and e.args[0] == errno.ECONNREFUSED:
NameError: global name 'errno' is not defined
***** Finished processing account Gmail
一开始我以为这可能是由于ISP的阻塞imap.gmail.com/imap.googlemail.com
,但是我可以使用telnet imap.googlemail.com 993
以下方法连接到它:
telnet imap.googlemail.com 993
Trying 173.194.79.16...
Connected to googlemail-imap.l.google.com.
Escape character is '^]'.
有任何想法吗?
编辑1:从SuperUser的此答案中,我尝试imap.googlemail.com
使用通过SSL 连接openssl s_client -connect imap.googlemail.com:993
。这给了我:
CONNECTED(00000003)
3078125768:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 226 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---
这看起来像OpenSSL中缺少证书问题。脱机IMAP也会发生同样的情况吗?
编辑2:我在运行Mandriva Linux版本2009.1的另一台服务器(位于同一网络上)上尝试了相同的OpenSSL命令,并且显然连接正常(调试输出)。我正在运行带有OpenSSL / LibSSL 1.0.1-4ubuntu5.5的Ubuntu 12.04。这可能与发行相关吗?