python sendmail

import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr

msg = MIMEText('邮件内容', 'plain', 'utf-8')
msg['From'] = formataddr(["XXX", 'xxx@fygame.com'])
#msg['To'] = formataddr(["走人", '943836458@qq.com'])
msg['Subject'] = "主题"
server = smtplib.SMTP("smtp.exmail.qq.com", 25)
server.login("xxx@fygame.com", "密码")
server.sendmail('xxx@fygame.com', ['xxx@qq.com','xxxx@qq.com' ], msg.as_string())
server.quit()
posted @ 2016-08-30 11:05  3one  阅读(216)  评论(0编辑  收藏  举报