我试图从python发邮件,但它显示
smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server.
这是我的代码:
from email.mime.text import MIMEText
import smtplib
def send_email(email):
from_email="mine@gmail.com"
from_password="xxxxx"
to_email=email
subject="Data"
message = "Hey there!!"
msg=MIMEText(message,'html')
msg['Subject']=subject
msg['To']=to_email
msg['From']=from_email
gmail=smtplib.SMTP('smtp.gmail.com',587)
gmail.connect('smtp.gmail.com',587)
gmail.ehlo()
gmail.starttls()
gmail.login(from_email,from_password)
gmail.sendmail(from_email,to_email,msg.as_string())
gmail.quit()
但gmail的安全功能不应该太差。我尝试过其他建议,如removestarttls()
命令,但没有任何效果。
我的问题在任何类似的帖子中都没有得到回答,所以在将其标记为重复之前,请先看一下。在
目前没有回答
相关问题 更多 >
编程相关推荐