#1.导包
import imaplib
#2.连接邮箱
host = "imap-mail.outlook.com"
username = "xxx@outlook.com"
password = "xxx"
port = 993
serv = imaplib.IMAP4_SSL(host, port)#3.登录邮箱
serv.login(username, password)
serv.select()#4.读取邮件
typ, data = serv.search(None, 'ALL')