開始報的這個:
command SEARCH illegal in state AUTH, only allowed in states SELECTED
死活找不到原因,Traceback裏提示:
File "/usr/lib/python3.5/imaplib.py", line 863, in uid
', '.join(Commands[command])))
於是打開imaplib.py找SELECTED,在731行找到:
self.state = 'AUTH' # Might have been 'SELECTED'
在上面的729行找到:
typ, dat = self._simple_command(name, mailbox)
於是print(dat),這纔看到:
The login is not safe! Please update your mail client: http://mail.163.com/dashi
爲了推自己的客戶端
好了,是163在做怪,錯怪imbox了,google一下找到:
http://stackoverflow.com/questions/27797705/python-login-163-mail-server
解決方案是通過下面的地址,配置一下即可:
http://config.mail.163.com/settings/imap/[email protected]
當然還看到這個方法,在命令前加C:
http://billynyh.github.io/blog/2015/05/16/javamail-163/