使用python和outlook发送邮件

2024-09-28 21:05:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python开发自己的软件。对于bug报告部分,我创建了一个outlook帐户。这是因为如果密码泄漏,这不是一个大问题。但是我找不到使用outlook发送邮件的方法。 这就是我尝试过的

from smtplib import SMTP
server = SMTP("smtp.outlook.com", 465)
server.starttls() 
server.login("myoutlookaccount@outlook.com", "mypassword")

这就是我在等待了5分钟后得到的错误

TimeoutError: [WinError 10060] Een verbindingspoging is mislukt omdat de verbonden party niet correct 
heeft geantwoord na een bepaalde tijd, of de gemaakte verbinding is mislukt omdat de verbonden host 
niet heeft geantwoord

(翻译)

TimeoutError: [WinError 10060] A connection attempt failed because the connected party was not correct 
replied after a certain time, or the connection created failed because the connected host 
did not reply

Tags: thecomserverispartydesmtpoutlook