标签:.net for from dma span /usr except 失败 print
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/10/23 0023 14:24 # @Author : ming def email(s, r, t): ret = True try: import smtplib from email.mime.text import MIMEText from email.utils import formataddr msg = MIMEText(s, "Plain", "utf-8") msg["from"] = formataddr(["杨永明", "18844123268@163.com"]) msg["To"] = formataddr(["TO", "bjyangyongming@corp.netease.com"]) msg["Subject"] = t server = smtplib.SMTP("smtp.163.com", 25) server.login("18844123268@163.com", "ming102318") server.sendmail("18844123268@163.com", [r], msg.as_string()) server.quit() except: ret = False return ret ret = email(t = "我是主题", r = "bjyangyongming@corp.netease.com", s = "我是内容") if ret == True: print "邮件发送成功" else: print "邮件发送失败"
|
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/10/23 0023 14:24 # @Author : ming def email(s, r, t): ret = True try: import smtplib from email.mime.text import MIMEText from email.utils import formataddr msg = MIMEText(s, "Plain", "utf-8") msg["from"] = formataddr(["杨永明", "18844123268@163.com"]) msg["To"] = formataddr(["TO", "bjyangyongming@corp.netease.com"]) msg["Subject"] = t server = smtplib.SMTP("smtp.163.com", 25) server.login("18844123268@163.com", "ming102318") server.sendmail("18844123268@163.com", [r], msg.as_string()) server.quit() except: ret = False return ret ret = email(t = "我是主题", r = "bjyangyongming@corp.netease.com", s = "我是内容") if ret == True: print "邮件发送成功" else: print "邮件发送失败"
|
标签:.net for from dma span /usr except 失败 print
原文地址:http://www.cnblogs.com/ming5218/p/7899201.html