python smtp发送邮件
2015-09-29 12:28
549 查看
http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386832745198026a685614e7462fb57dbf733cc9f3ad000
def send_mail(receiver, subject, body):
print "send mail: ", subject
sender = 'xxx@abc.com'
m = MIMEMultipart()
m['to'] = receiver
m['from'] = sender
m['subject'] = subject
m.attach(MIMEText(body, 'html', 'utf-8'))
#print m.as_string()
s = smtplib.SMTP()
s.connect()
s.sendmail(sender, [receiver], m.as_string())
s.close()
def send_mail(receiver, subject, body):
print "send mail: ", subject
sender = 'xxx@abc.com'
m = MIMEMultipart()
m['to'] = receiver
m['from'] = sender
m['subject'] = subject
m.attach(MIMEText(body, 'html', 'utf-8'))
#print m.as_string()
s = smtplib.SMTP()
s.connect()
s.sendmail(sender, [receiver], m.as_string())
s.close()
相关文章推荐
- python生成html
- Numpy溢出
- python安装第三方库
- python打开自已配置的firefox
- Python查询天气预报
- python string to hex,字符串转16进制
- Python 数据排序和列表迭代和列表推导应用
- 用python进行服务器的监控
- python string methods 和 string module区别
- python 自动化测试平台 Robot Framework快速入门
- python 自动化测试平台 Robot Framework 内置库 翻译
- Python自然语言处理(一)--利用NLTK自带方法完成NLP基本任务
- [转载]Python爬虫入门七之正则表达式
- python re.search 和 re.match 正则表达式
- python与字符集编码
- Python解释器的探讨:第二部分代码对象
- Python解释器的探讨:第二部分代码对象
- python笔记
- numpy argsort排序函数
- [转载]Python爬虫入门四之Urllib库的高级用法