为了账号安全,请及时绑定邮箱和手机立即绑定

Python smtplib:无法向手机发送短信

Python smtplib:无法向手机发送短信

人到中年有点甜 2021-11-16 16:34:16
我正在尝试使用 SMTP 协议向我的手机发送消息。如果我登录我的 Google 帐户(为此我启用了安全性较低的应用程序),我可以向“5551234567@tmomail.net”发送消息。电子邮件的主题和正文以短信形式到达我的手机。但是,当我尝试对 Python 的smtplib库执行相同操作时,我没有收到消息。这是我正在使用的代码:import smtplib# Establish a secure session with gmail's outgoing SMTP server using your gmail accountserver = smtplib.SMTP("smtp.gmail.com", 587)server.starttls()# the account that will send the emailsserver.login('me@gmail.com', 'password')# sendmail(from, to, msg)server.sendmail('me@gmail.com', '5551234567@tmomail.net', 'hey there!')有谁知道我能做些什么来让短信通过smtplib?非常欢迎任何建议!
查看完整描述

1 回答

?
守候你守候我

TA贡献1802条经验 获得超10个赞

尝试检查下面的链接。

如果你好像忘记了

服务器.elo()

如何使用 Python 使用 Gmail 作为提供商发送电子邮件?

如果您在 Gmail 收件箱的 SENT emails 文件夹中看到 python 消息,请告诉我们。

如果是,请尝试找出从浏览器发送的和从 Python API 发送的区别。


查看完整回答
反对 回复 2021-11-16
  • 1 回答
  • 0 关注
  • 179 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信