其他分享
首页 > 其他分享> > yagmail 报错SSL WRONG_VERSION 的坑

yagmail 报错SSL WRONG_VERSION 的坑

作者:互联网

发送邮件

邮箱使用25 端口发送邮件,yagmail 报错
SSL WRONG_VERSION ????
一头雾水,后面换成465 端口就正常了。不知道操作,后续看源码研究下

  def send_mail(self ,file):
        # 链接邮箱服务器
        password = ""
        user = ""
        yag = yagmail.SMTP(user=user, password=password, host='smtp.qq.com', port='465')

        # 邮箱正文
        contents = []
        contents.append("{元素,出现差异")
        contents.append(file)
        # 发送邮件
        yag.send(to=to, subject='subject', contents=contents)

标签:password,SSL,WRONG,报错,user,邮箱,yagmail,邮件,contents
来源: https://blog.51cto.com/12187730/2538869