python一个发邮件的函数
2015-12-09 15:43
639 查看
from datetime import date,timedelta from email.mime.text import MIMEText def mailto(rec_list,mail_content): sender=-.com' smtpserver='.com' user='guanzhongkai' passwd='' content = file(mail_content ).read() msg=MIMEText(content,'plain') msg['From']=sender msg['Subject']="PV last week of Mobile-BU" msg['To']=",".join(rec_list) smtp=smtplib.SMTP() smtp.connect('','') smtp.starttls() # smtp.set_debuglevel(1) smtp.login(user,passwd) smtp.sendmail(sender,rec_list,msg.as_string()) smtp.quit()
相关文章推荐
- python基础教程共60课-第15课循环的嵌套
- python学习笔记之各种函数各种库
- python tkinter 文件MD5校验工具
- 在Python中新建一个instance有几种办法?
- [python基础]关于包,类,模块的那些事儿
- Python爬取返利网(今日值得买)数据
- python中的全局变量
- python基础教程共60课-第14课字符串格式化
- python中文翻译资料
- 十分钟搭建Windows版Python开发环境(Eclipse+PyDev)
- Python读写文件
- Python模块——bisect
- python基础教程共60课-第13课字符串
- 零基础入门学习Python(5):列表
- Python程序员常犯的10个错误
- Python异常
- python类的继承与多态
- Python:一句话的优雅
- python基础教程共60课-第12课for循环
- Python 程序员经常犯的 10 个错误