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)
相關文章
相關標籤/搜索