#!/usr/bin/env python # coding=utf-8 import smtplib from email.mime.text import MIMEText def mailf(errdate,biaoti): user = "shishuicer@tom.com" pwd = "3。。。。4一排" to = "zxx@xxxx.com" msg = MIMEText(errdate) msg["Subject"] = biaoti msg["From"] = _user msg["To"] = _to s = smtplib.SMTP("smtp.tom.com", timeout=300) s.login(_user, _pwd) s.sendmail(_user, _to, msg.as_string()) s.close() if __name__==‘__main__‘: mailf(‘neirong‘,‘header‘)
原文地址:http://zhangxiaohe.blog.51cto.com/7821029/1674941