#encoding =utf-8__author__ = ' ds ' #文件名称冲突from email.mime.text import mimetextimport smtplibif __name__ = = ' __main__ ': msg = mimetext (_text= ' SMTP test ', _charset= ' utf-8 ') #输入Email地址和口令: from_addr = ' [email protected] ' Password = ' XXX ' # Enter SMTP server address: smtp_server = ' smtp.qq.com ' # Enter recipient address: to_addr = ' [email protected] ' #SMTP协议默认端口是25 Server = Smtplib. SMTP (smtp_server) server.set_debuglevel (1) #server. STARTTLS () #server. Connect (host=smtp_ Server, port=25) #server. esmtp_features["auth"]= "Auth_login" server.login (from_addr, password) Server.sendmail (FROM_ADDR, [to_addr], msg.as_string ()) server.quit ()
After the test has been reported 454 error, the original QQ mailbox will mail the SMTP service closed, external inaccessible
Open the account security of QQ email account and open the SMTP service and POP3 service
Python sends QQ mail