代码之家  ›  专栏  ›  技术社区  ›  duhaime

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

  •  0
  • duhaime  · 技术社区  · 6 年前

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

    有人知道我能做些什么来让短信从 ? 欢迎提出任何建议!

    1 回复  |  直到 6 年前
        1
  •  1
  •   Max    6 年前

    如果你似乎忘记了

    server.ehlo()

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

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