【问题标题】:Python SMTP Email not reaching recipentPython SMTP 电子邮件未到达收件人
【发布时间】:2017-02-13 16:27:56
【问题描述】:

我正在尝试运行一个在 python 3.5 中使用 smtplib 发送电子邮件的程序,但它不工作。正在发送电子邮件,收件人在其收件箱中看到一封电子邮件,但它是空的(邮件内容不存在)。代码看起来有点像这样:

message = "Test Message"
server = smtplib.SMTP("smtp.live.com", 25)
server.starttls()
server.login("someone@hotmail.com", "someones_password")
server.sendmail("someone@hotmail.com", someone_else@somewhere.com, message)

谁能告诉我我做错了什么?

【问题讨论】:

    标签: python email smtp smtplib


    【解决方案1】:

    您是否尝试在server.starttls() 之前使用server.ehlo()

    像这样:

    message = "Test Message"
    server = smtplib.SMTP("smtp.live.com", 25)
    server.ehlo()
    server.starttls()
    server.login("someone@hotmail.com", "someones_password")
    server.sendmail("someone@hotmail.com", someone_else@somewhere.com,  message)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-20
      • 1970-01-01
      • 2015-01-20
      • 1970-01-01
      • 2021-10-11
      • 2019-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多