python发送邮件
来源:互联网 发布:电饭煲推荐 知乎 编辑:程序博客网 时间:2024/06/05 20:19
发送普通文本邮件
#coding=utf-8'''Created on 2017-04-01@author: Why'''import smtplibimport subprocessfrom email.mime.text import MIMEText mailto = ['15211219112@139.com']#接收邮件邮箱#发送邮件邮箱参数mail_host="smtp.163.com" mail_user="15211219112" mail_pass="yourmailpassword" mail_postfix="163.com"def send_mail(to_list,sub): content='Home cam warning!'#发送邮件内容 me="Why"+"<"+mail_user+"@"+mail_postfix+">" msg = MIMEText(content,_subtype='plain',_charset='gb2312') msg['Subject'] = sub msg['From'] = me msg['To'] = ";".join(to_list) server = smtplib.SMTP() server.connect(mail_host) server.login(mail_user,mail_pass) server.sendmail(me, to_list, msg.as_string()) server.close() return True if __name__ == '__main__': if send_mail(mailto,"title"): #发送邮件标题 print("发送成功") else: print("发送失败")
0 0
- 用Python发送邮件
- Python 发送邮件
- python 邮件发送
- 使用PYTHON发送邮件
- python邮件发送
- python发送邮件程序
- python: 发送邮件
- python发送邮件
- python smtp发送邮件
- python 发送邮件实例
- python发送各类邮件
- 用Python发送邮件
- 用Python发送邮件
- python 发送邮件实例
- Python发送邮件测试
- python发送邮件
- python发送邮件
- python发送邮件
- 洛谷 P1119 灾后重建
- 在WEB编程中response.sendRedirect()传汉字参数乱码问题
- 加速堆排序的C++实现
- 【机器学习 基本概念】泊松分布与美国枪击案
- Spring+Dubbo+MyBatis+Linner分布式Web开发环境搭建(二)
- python发送邮件
- jfree chart-时序图
- 后缀数组【倍增计数排序求sa】poj1743
- 可以在main函数之前执行的函数
- Time
- select查询语句执行顺序
- fastjson扩展——多态支持
- UnicodeDecodeError: 'utf8' codec can't decode byte 0xc9 in position 0: inval
- (转)Android 通过WebView和js的交互