msgtype = 'html'
mailto_list = ["xxx@qq.com"]
mail_host = "smtp.163.com"
mail_user = "xxx@163.com"
mail_pwd = "xxx"
me = u"点点寒彬|SvenWeng" + "<" + mail_user + ">"
msg = MIMEText("Hello World!
", _subtype=msgtype, _charset='utf8')
msg['Subject'] = 'theme'
msg['From'] = me
msg['To'] = ";".join(mailto_list)
try:
s = smtplib.SMTP()
s.connect(mail_host) # 连接smtp服务器
s.login(mail_user, mail_pwd) # 登陆服务器
s.sendmail(me,mailto_list, msg.as_string()) # 发送邮件
s.close()
return True
except Exception, e:
print str(e)
return False