The two places to be aware of when using QQ mail server are:
1. Protocol issues using the 465-Port SSL protocol
2. Password problem occurs smtpauthenticationerror main reason is the password and account information is not correct, here we use QQ server send need to set up a separate password in the mailbox (must), and then open
SMTP/POP3 Services. Then with the QQ Mobile Security Center sweep will give an authorization code, in the code to fill in the password is this authorization code , not the mailbox password!
Here's a code:
#Coding:utf8From SmtplibImportSmtp_sslFrom Email.headerImportHeaderFrom Email.mime.textImportMimetextmail_info ={"From":"xxxx@qq. com","To":"XXX@qq. com","Hostname":"Smtp.qq.com","Username":"XXX@qq. com","Password":"Xxx","Mail_subject":"Test","Mail_text":"Hello, this was a test email, sended by py","Mail_encoding":"Utf-8"}If__name__ = =‘__main__‘:#Using Smtp_ssl here is the default use of port 465 SMTP = SMTP_SSL (mail_info["Hostname"]) Smtp.set_debuglevel (1) Smtp.ehlo (mail_info["Hostname"]) Smtp.login (mail_info["Username"], mail_info["Password"]) msg = Mimetext (mail_info["Mail_text"],"Plain", mail_info["Mail_encoding"]) msg["Subject"] = Header (mail_info["Mail_subject"], mail_info["Mail_encoding "" from "] = Mail_info[" From " Msg[" to "] = Mail_info[ to< Span style= "color: #800000;" > " Smtp.sendmail (Mail_info[" fromto "", msg.as_string ()) smtp.quit ()
The Debian System OS command gnome-screenshot-a the custom area files in the picture folder in the HOME directory.
Http://www.cnblogs.com/inva/p/5115794.html
Python sends mail using smtplib library and smtp.qq.com Mail server (GO)