开始报的这个:
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/