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

“连接意外关闭”SMTP Gmail Python 3

  •  0
  • iamsnaks  · 技术社区  · 7 年前

    想知道是否有人对此有任何想法?

    当我运行以下脚本时,它总是创建与SMTP的握手,然后取消中间进程,并出现错误“SMTPServerDisconnected:连接意外关闭”?

    ##Email addresses for sender and recpient are correct when in use.
    
    import smtplib
    
    smtpObj = smtplib.SMTP('smtp.gmail.com', 465)
    smtpObj.ehlo()
    smtpObj.login('###########@gmail.com', '#Password')
    smtpObj.sendmail('#########@gmail.com', '#########@gmail.com', 'Subject: 
    Test.')
    
    smtpObj.quit()
    ##Connection end
    

    如果您有任何想法或想法,我们将不胜感激,提前感谢!:)

    1 回复  |  直到 7 年前
        1
  •  0
  •   iamsnaks    7 年前