【问题标题】:Python smtplib: Unable to send sms messages to phonePython smtplib:无法向手机发送短信
【发布时间】:2019-02-22 23:52:46
【问题描述】:

我正在尝试使用 SMTP 协议向我的手机发送消息。如果我登录到我的 Google 帐户(我有 enabled less secure apps),我可以向“5551234567@tmomail.net”发送消息。电子邮件的主题和正文以短信形式发送到我的手机。

但是,当我尝试对 Python 的 smtplib 库执行相同操作时,我没有收到消息。这是我正在使用的代码:

import smtplib

# Establish a secure session with gmail's outgoing SMTP server using your gmail account
server = smtplib.SMTP("smtp.gmail.com", 587)

server.starttls()

# the account that will send the emails
server.login('me@gmail.com', 'password')

# sendmail(from, to, msg)
server.sendmail('me@gmail.com', '5551234567@tmomail.net', 'hey there!')

有谁知道我可以做些什么来让来自smtplib 的短信通过?非常欢迎任何建议!

【问题讨论】:

    标签: python smtplib


    【解决方案1】:

    尝试检查下面的链接。

    如果你忘记了

    server.ehlo()

    How to send an email with Gmail as provider using Python?

    如果您在 Gmail 收件箱的已发送电子邮件文件夹中看到 python 消息,请告诉我们。

    如果是,请尝试找出您从浏览器发送的内容与您从 python API 发送的内容之间的差异。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-12
      • 1970-01-01
      • 2018-02-11
      • 2011-03-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多