- 获取qq邮箱授权码
什么是授权码,它又是如何设置? - 代码
import smtplib from email.mime.text import MIMEText user = "你的qq邮箱" pwd = "你的授权码" to = "要发送的邮箱" msg = MIMEText("Test") msg["Subject"] = "don't panic" msg["From"] = user msg["To"] = to try: s = smtplib.SMTP_SSL("smtp.qq.com", 465) s.login(_user, pwd) s.sendmail(_user, _to, msg.as_string()) s.quit() print("发送成功") except smtplib.SMTPException,e: print ("失败,%s" %e)