offlineimap读取qq邮箱

qq邮箱启用imap

首先要在qq邮箱打开imap设置,需要进入qq网站关闭邮箱安全保护,要用到手机短信验证。

这一系列操作完成后,可以获得密码。


设置offlineimap

在~/.offlineimaprc文件中如下设置

[general]
accounts = qq
maxsyncaccounts = 3

[Account qq]
localrepository = Local
remoterepository = Remote
status_backend = sqlite

[Repository Local]
type = Maildir
localfolders = ~/mail

[Repository Remote]
type = IMAP
remotehost = imap.qq.com
ssl = yes
remoteuser = [email protected]
remotepass = pwd-from-qq-site
maxconnections = 1
realdelete = no
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

运行命令读取邮件

~ $ offlineimap
OfflineIMAP 7.0.7
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Account sync qq:
 *** Processing account qq
 Establishing connection to imap.qq.com:993 (Remote)
 Creating folder Junk[Local]
 Creating new Local Status db for Local:Junk
 Creating folder Sent Messages[Local]
 Creating new Local Status db for Local:Sent Messages
 Creating folder Deleted Messages[Local]
 Creating new Local Status db for Local:Deleted Messages
 Creating folder Drafts[Local]
 Creating new Local Status db for Local:Drafts
 Creating folder INBOX[Local]
 Creating new Local Status db for Local:INBOX
Folder Deleted Messages [acc: qq]:
 Syncing Deleted Messages: IMAP -> mail
Folder Drafts [acc: qq]:
 Syncing Drafts: IMAP -> mail
 Copy message UID 70 (1/26) Remote:Drafts -> Local
 Copy message UID 71 (2/26) Remote:Drafts -> Local
 Copy message UID 72 (3/26) Remote:Drafts -> Local
 Copy message UID 73 (4/26) Remote:Drafts -> Local
 Copy message UID 74 (5/26) Remote:Drafts -> Local


检查一下

~ $ tree ~/mail/ -L 1
/home/dean/mail/
├── Deleted Messages
├── Drafts
├── INBOX
├── Junk
└── Sent Messages

5 directories, 0 files
$ du -sh ~/mail/
87M	/home/dean/mail/

好,一切正常。


你可能感兴趣的:(#,Emacs,Email)