http://www.cnblogs.com/lonelycatcher/archive/2012/02/09/2343463.html
http://blog.csdn.net/imzoer/article/details/8674263
亲测OK
打开qq邮箱,点击设置->
账户,找到POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务,开启IMAP/SMTP服务,然后根据要求使用手机发送到指定号码,获取授权码,
这个授权码就是你接下来登录要使用的密码,配置完成,上代码
import smtplib
from email.mime.text import MIMEText
_user = "你的qq邮箱"
_pwd = "你的授权码"
_to = "501257367@163.com"
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 "Success!"
except smtplib.SMTPException,e:
print "Falied,%s"%e