#!/usr/bin/env python
import smtplib
from email.utils import formataddr
from email.mime.text import MIMEText
def email(p,text,subject):
msg = MIMEText(text,'plain','utf-8')
msg['From'] = formataddr(['xxx','xxxx@126.com'])
msg['To'] = formataddr(['ooo','ssss@qq.com'])
msg['Subject'] = subject
sever = smtplib.SMTP('smtp.126.com',25)
sever.login('xxxx@126.com','password')
sever.sendmail('xxxx@126.com',\[p,\],msg.as\_string())
sever.quit()
手机扫一扫
移动阅读更方便
你可能感兴趣的文章