import imaplib,email,getpass from email.utils import getaddresses #Email settings imap_server = 'imap.qq.com' imap_user = '******@qq.com' imap_password = '*******'#这里是授权码 #Connection conn = imaplib.IMAP4_SSL(imap_server) (retcode,capabilities) = conn.login(imap_user,imap_password) print(conn.list()) conn.select('INBOX') #search for ids between dates specified result,data = conn.uid('search',None,b'(SINCE "01-Dec-2016" BEFORE "24-Dec-2016")') uids = data[0].split() #Download headers result,data = conn.uid('fetch',','.join(uids), 'BODY[HEADER]')
错误提示如下