在Arch Linux下,我想用offlineimap
这样的方式同步到GMail。
[general]
accounts = Gmail
maxsyncaccounts = 3
[Account Gmail]
localrepository = LocalGmail
remoterepository = RepositoryGmail
autorefresh = 30
quick = 10
postsynchook = mu index --maildir ~/.offlineimap/Gmail
[Repository LocalGmail]
type = GmailMaildir
localfolders = ~/.offlineimap/Gmail
[Repository RepositoryGmail]
type = Gmail
maxconnections = 2
remoteuser = my.gmail.accountname
remotepass = gmailapppassword
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail', '[Gmail]/Important']
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
由于 SSL 的某些问题而失败。
$ offlineimap -o -a Gmail
OfflineIMAP 7.2.1
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (bundled), Python v2.7.15, OpenSSL 1.1.1a 20 Nov 2018
Account sync Gmail:
*** Processing account Gmail
Establishing connection to imap.gmail.com:993 (RepositoryGmail)
ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for repository 'RepositoryGmail'. OpenSSL responded:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)
我在其他地方读到我可以通过运行来检查 SSL 连接
$ openssl s_client -showcerts -connect imap.gmail.com:993
[...]
* OK Gimap ready for requests from 217.63.244.188 s26mb317463625edc
对我来说,这表明错误实际上并不在于 SSL 连接,而在于如何offlineimap
处理它。证书文件``存在并包含 GlobalSign 根 CA - R2 证书。
只是为了确保我已经使用各自的s 安装six
并安装了干净的 python2.7 和干净的 python3.7 virtualenv ,并且仍然存在。offlineimap
pip
CERTIFICATE_VERIFY_FAILED
如何让 Offlineimap 与 GMail 对话?
答案1
在 arch OpenSSL 上现在是 1.1.1,它在使用 imaplib2 时遇到了麻烦
https://github.com/imaplib2/imaplib2/issues/5
如以下所述:
https://github.com/OfflineIMAP/offlineimap/issues/573
您可以将 ssl_version=tls1_2 添加到 .offlineimaprc 中,这将解决问题