import smtplib
from email.mime.text import MIMEText
subject = ‘this is my first 163‘br/>frommail=‘m17731xxxxx@163.com‘
tomail=‘6423xxxx1@qq.com‘
msg=MIMEText(r‘ha ha‘)br/>msg[‘Subject‘]=subject
msg[‘From‘]=frommail
msg[‘To‘]=tomail
server=smtplib.SMTP()
server.connect(‘smtp.163.com‘)
server.login(‘m17731708341@163.com‘,‘miaxxxxx45‘)
server.sendmail(frommail,tomail,msg.as_string())
QQ邮件 开启白名单
python 发送邮件
原文:http://blog.51cto.com/13214087/2154363