python连接outlook邮箱

#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')

posted @ 2021-06-16 18:35  Merge_1126  阅读(710)  评论(0编辑  收藏  举报