Offlineimap 未知 SSL 协议错误

Offlineimap 未知 SSL 协议错误

我用来offlineimap从多个 IMAP 服务器获取邮件。这曾经有效,但今天offlineimap无法获取邮件,产生以下错误:

*** Processing account example
 Establishing connection to imap.gmail.com:993
 ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for
 repository '<redacted>'. OpenSSL responded:
 [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
*** Finished account 'example' in 0:00

我的配置的相关部分是:

[Account example]
localrepository  =  local-example
remoterepository = remote-example

[Repository local-example]
type = Maildir
localfolders = ~/mail/example

[Repository remote-example]
maxconnections = 1
type = Gmail
remotehost = imap.gmail.com
remoteuser = [email protected]
remotepasseval = get_keychain_pass(account="[email protected]",
                                   server="imap.gmail.com")
ssl = yes
sslcacertfile = /usr/local/etc/openssl/certs/dummycert.pem

sslcacertfile配置是为了响应而创建的这个答案。该get_keychain_pass函数来自这个离线imap配置

我正在offlineimapOS X 10.10.4 上使用 Homebrew 构建的 6.5.7。

答案1

当我安装 Homebrew 版本的 python 而不是 Apple 版本时,问题就开始了。通过运行解决了该错误

brew uninstall python

我通过阅读以下内容发现这是解决方案类似的错误由 OS X 上的另一个 Python 程序生成。

答案2

我需要安装 Apple 版本和 Homebrew 版本的 Python。我需要从 pip 安装一些软件包,但我没有对这台工作发行的 Macbook Pro 的管理访问权限。因此,我唯一可用的点是 Homebrew。我最终做的是在启动offlineimap.py脚本之前设置以下PYTHONPATH:

PYTHONPATH="/Library/Python/2.7/site-packages" exec "/Users/tblancher/homebrew/Cellar/offlineimap/7.0.7/libexec/offlineimap.py" "$@"

我还修改了offlineimap.py脚本本身。我改变了第一行:

#!/usr/bin/env python

对此:

#!/usr/bin/python

显然 env 发现它在 Homebrew 中,因此尝试使用 Homebrew python。 Offlineimap 现在可以正常工作,我的 Homebrew-pip 安装的 Python 包(mutt-ics,如果你好奇的话)也可以正常工作。

相关内容