1 2 3 4 5 6 7 8 9 10 11 12 13 14
| conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login(accout, password) print(conn.list()) #即可打印下方内容,只要在select里填入/后面的内容就能进行对应的操作 # print(conn.list())# 打印邮箱所有文件夹 # conn.select('INBOX') # 选择收件箱 # [b'(\\HasNoChildren) "/" "INBOX"', # 收件箱 # b'(\\HasChildren \\Noselect) "/" "[Gmail]"', # 未读邮件 # b'(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCuTvY-"' # 垃圾邮件 # b'(\\HasNoChildren \\Trash) "/" "[Gmail]/&XfJSIJZkkK5O9g-"' # 垃圾箱 # b'(\\Flagged \\HasNoChildren) "/" "[Gmail]/&XfJSoGYfaAc-"' # 星标 # b'(\\HasNoChildren \\Sent) "/" "[Gmail]/&XfJT0ZCuTvY-"' # 已发送 # b'(\\All \\HasNoChildren) "/" "[Gmail]/&YkBnCZCuTvY-"' # 所有邮件 # b'(\\Drafts \\HasNoChildren) "/" "[Gmail]/&g0l6Pw-"' # 草稿 # b'(\\HasNoChildren \\Important) "/" "[Gmail]/&kc2JgQ-"'] # 重要邮件
|