编程语言
首页 > 编程语言> > python连接outlook邮箱

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

标签:serv,username,outlook,python,imaplib,邮箱,port
来源: https://blog.51cto.com/u_14477836/2908906