I'm trying to setup OfflineIMAP to sync my Gmail account to
~/Mail/Gmail. I'm using a pretty basic
~/.offlineimaprc from here. But OfflineIMAP doesn't connect to Gmail at all. This is the debug message I'm getting (by running OfflineIMAP as
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 == errno.ECONNREFUSED: NameError: global name 'errno' is not defined ***** Finished processing account Gmail
In the beginning I thought this could be due to my ISP blocking
imap.gmail.com/imap.googlemail.com, but I'm able to connect to it using
telnet imap.googlemail.com 993:
telnet imap.googlemail.com 993 Trying 184.108.40.206... Connected to googlemail-imap.l.google.com. Escape character is '^]'.
EDIT 1: From this answer on SuperUser, I tried connecting to
imap.googlemail.com via SSL using
openssl s_client -connect imap.googlemail.com:993. This gives me:
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 ---
This looks like a missing certificate problem in OpenSSL. Could the same be happening to OfflineIMAP too?
EDIT 2: I tried the same OpenSSL commands on another server (on the same network) running Mandriva Linux release 2009.1 and apparently the connection worked (debug output). I'm running Ubuntu 12.04 with OpenSSL/LibSSL 1.0.1-4ubuntu5.5. Could this be distro related?