做个python的发送邮件,一直报错ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129),求教解决方法。
代码如下:
import smtplib
from email.mime.text import MIMEText
msg_from="发送方邮箱"
ps="第三方授权码"
to="收件方邮箱"
subject = "来自python的邮件"
content=("测试邮件")
msg=MIMEText(content)
msg["From"]=msg_from
msg["To"]=to
msg["Subject"]=subject #["Subject"]
mail = smtplib.SMTP_SSL("smtp.163.com",25)
mail.login(msg_from,ps)
mail.sendmail(msg_from,to,msg.as_string())
mail.quit()
运行结果及报错内容 :
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)
希望指教。