文件:send.py

# -*- coding:utf-8 -*-
#
## 任兴测试用Python发送邮件 import os
import sys
import getopt
import time
import datetime
import string
import os
import datetime
import urllib
import md5 from decimal import * import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
import email #to 收件人邮箱,多个用逗号分隔
def send_mail(title,info,to):
s = smtplib.SMTP_SSL("smtp.exmail.qq.com") username = "abcd@qq.com" #发送邮件的邮箱账号
password = "" #发送邮件的邮箱密码 msg = MIMEMultipart()
msg["Subject"] = title
msg["From"] = username
msg['To'] = ";".join(to)
text_msg = email.MIMEText.MIMEText(info,"html","utf-8") msg.attach(text_msg) s.login(username,password)
s.sendmail(username,to,msg.as_string())
s.close() if __name__ == '__main__':
send_mail("this is title","hello,sir,this is body...",["123@qq.com","456@qq.com"])

运行方式: python send.py

用Python发送邮件的更多相关文章

  1. python发送邮件

    python发送邮件(无附件) ======================================================= #!/usr/bin/env python#coding ...

  2. python发送邮件及附件

    今天给大伙说说python发送邮件,官方的多余的话自己去百度好了,还有一大堆文档说实话不到万不得已的时候一般人都不会去看,回归主题: 本人是mac如果没有按照依赖模块的请按照下面的截图安装 导入模块如 ...

  3. python 发送邮件实例

    留言板回复作者邮件提醒 -----------2016-5-11 15:03:58-- source:python发送邮件实例

  4. 解读Python发送邮件

    解读Python发送邮件 Python发送邮件需要smtplib和email两个模块.也正是由于我们在实际工作中可以导入这些模块,才使得处理工作中的任务变得更加的简单.今天,就来好好学习一下使用Pyt ...

  5. python 发送邮件例子

    想到用python发送邮件 主要是服务器 有时候会产生coredump文件  ,然后因为脚本重启原因,服务器coredump产生后会重启 但是没有主动通知开发人员 想了下可以写个脚本一旦产生cored ...

  6. 利用python发送邮件

    找了很多使用python发送邮件的文章, 发现写的并不是太全, 导致坑特别多, 刚把这个坑跨过去, 在此记录下来 本代码使用163作为发送客户端, 接收邮箱随意 首先登录163邮箱, 开启POP3/S ...

  7. ETL过程跑完后,使用python发送邮件

    目标库中,如果有行数为0的表,使用python发送邮件 # -*- coding:utf-8 -*- # Author: zjc # Description:send monitor info to ...

  8. 【转】【Python】Python发送邮件(常见四种邮件内容)

    在写脚本时,放到后台运行,想知道执行情况,会通过邮件.SMS(短信).飞信.微信等方式通知管理员,用的最多的是邮件.在linux下,Shell脚本发送邮件告警是件很简单的事,有现成的邮件服务软件或者调 ...

  9. 使用python发送邮件

    最近需要做一个功能,统计bug的数量,然后发邮件给指定人,所有就先要了解一下使用python发送邮件 代码如下: #coding: utf-8 import smtplib from email.MI ...

随机推荐

  1. Dig out WeChat deleted chat messages on Android Phone

    As we know that WeChat will wipe deleted chat messages. That's why forensic guys could  not dig out ...

  2. Phpstorm10 主题下载

    ================================================================================ submit:主题 http://ww ...

  3. mysql远程连接缓及缺少*.dll文件解决方案

    1.mysql远程连接缓慢 # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5. ...

  4. NSString拼接字符串

    NSString* string; // 结果字符串 02 NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来 03   04 / ...

  5. 【开发技术】如何查看项目中struts的版本

    struts-configer.xml(struts1)或struts.xml(struts2)中 struts-2.0.dtd处表示版本号

  6. Angular4+路由

    路由的作用就是(导航):会加载与请求路由相关联的组件,并获取特定路由的相关数据,这允许我们通过控制不同的路由,获取不同的数据,从而渲染不同的页面: 几种常见的路由配置: Angular路由器是一个可选 ...

  7. sqlserver 字符串截取与拼接

    update yanan set name=name+right(phone,4) where id=56 其中right(phone,4)是截取手机号后四位,left是从左开始截取.name=nam ...

  8. java利用poi生成/读取excel表格

    1.引入jar包依赖 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi< ...

  9. Python 正则表达式 (python网络爬虫)

    昨天 2018 年 01 月 31 日,农历腊月十五日.20:00 左右,152 年一遇的月全食.血月.蓝月将今晚呈现空中,虽然没有看到蓝月亮,血月.月全食也是勉强可以了,还是可以想像一下一瓶蓝月亮洗 ...

  10. js 生成 UUID

    在项目中遇到要生成 UUID 的需求,第一反应就是有没有原生的生成方法,找了找,发现没有,只能自己建立算法 function. 下面是我用的算法 function uuid(len, radix) { ...