非ssl给163发邮件,报错,无解ing

#给163发送邮件
import smtplib
from email.mime.text import MIMEText
nam='[email protected]'
send='[email protected]'
receive='[email protected]'
pw = '37193350d' #此密码有误,运行时需修改
server='smtp.163.com'
port=0
message=MIMEText('<p>这是网页正文</p>','html','utf-8')
message['From']='xiatian'
message['To']='dongtian'
message['Subject']='big title'
smtp=smtplib.SMTP()
smtp.connect(server,25)
smtp.login(nam,pw)
smtp.sendmail(send,receive,message.as_string())
smtp.quit()
print('邮件发送成功,请查收')

猜你喜欢

转载自www.cnblogs.com/canglongdao/p/12013291.html