Try to write a script to send e-mail but failed
#-*-coding: utf-8 -*-
'''
使用Python去发送邮件
但是不成功,运行后,等待一段时间, 返回[Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
email send fail
'''
import smtplib
from email.mime.text import MIMEText
HOST='smtp.163.com'
PORT=25
TIMEOUT='30'
USER='m17606719860'
USERA='m17606719860@163.com'
PREFIX='163.com'
PASSWORD='cc1842'
to_list=['chen.chen@ecitele.com']
content='python send email test'
sub='hello,world'
def sendmail(to_list,sub,content):
me='hello'+'<'+USER+'@'+PREFIX+'>'
msg=MIMEText(content,_subtype='plain',_charset='gb2312')
msg['Subject']= sub
msg['From']=me
msg['To']=','.join(to_list)
try:
smtp=smtplib.SMTP()
smtp.set_debuglevel(1)
smtp.connect(HOST,PORT)
smtp.login(USER,PASSWORD)
smtp.sendmail(me,to_list,msg.as_string())
smtp.quit()
print 'email send success'
except Exception,e:
print e
print 'email send fail'
if __name__=='__main__':sendmail(to_list,sub,content)
Try to write a script to send e-mail but failed的更多相关文章
- Cannot send, channel has already failed:
背景: 一个同事往这个队列发数据,另一个同事从这个队列取数据,进行解析. 这是昨天同事昨天消费者 消费activemq 队列,一开始有正常,运行了一段时间后,发现突然消费者变为零了.因为有监控.之后怎 ...
- org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed
项目是使用activeMQ 发布订阅的模式,在本地测试正常,但是 放到服务器上出现这个错误: org.apache.activemq.transport.InactivityIOException: ...
- Send [1] times, still failed
com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [696094] ...
- fwrite(): send of 8192 bytes failed with errno=104 Connection reset by peer
问题:fwrite(): send of 8192 bytes failed with errno=104 Connection reset by peer 问题描述 通过mysql + sphinx ...
- UiPath: Send SMTP Mail Message 发送带附件的邮件
Tips:关于Hotmail的server和port的获取方式,请参考以下链接 https://support.office.com/en-us/article/Server-settings-you ...
- PHP系列 | PDO::prepare(): send of 68 bytes failed with errno=32 Broken pipe
设计场景 1.开启Redis的键空间过期事件(键过期发布任务),创建订单创建一个过期的key,按照订单号为key,设置过期时间. 2.通过Redis的订阅模式(持久阻塞),获取到订单号进行组装. 3. ...
- ActiveMQ Cannot send, channel has already failed: tcp:127.0.0.1:8161
仅针对如下错误内容: Cannot send, channel has already failed: tcp://127.0.0.1:8161 一种尝试解决,修改连接端口为 61616: tcp:/ ...
- CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案
按照 http://www.1207.me/archives/209.html 的教程安装Scrapy出现了上述错误,但是本身机器已经有了gcc,所以应该是安装包的问题 百度又看到了同博客里的解决方案 ...
- Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 解决办法
今天在Ubuntu16.04 上安装python包的时候,出现了这个坑爹的问题: 解决办法,内容总结如下 情况是这样,报错是因为没有把依赖包安装全,报错情况如下图: 解决办法,先安装一些必须的依赖: ...
随机推荐
- java 读写文件
1. 读文件 import java.io.*; import java.util.*; public class test { public void test_readfile(String fi ...
- Warning C4819
VC工程里有个文件,只有文件里写了汉字,就报警告C4819 Warning C4819:The file contains a character that can ot be represented ...
- VSCode+Ionic+Apache Ripple开发环境搭建
vscode作为一个轻量级编辑器,有其独特的魅力. 安装Ionic:npm install -g ionic 安装Apache Ripple模拟器: npm install -g ripple-emu ...
- pip安装
首先安装 python 和python-devel 然后 https://pypi.python.org/pypi/pip/ 下载 tar.gz 解压,安装 tar zxvf pip-8.1.1.ta ...
- .NET 扩展方法(Extention Method)的要点
扩展方法Extention Method的主要介绍在:http://msdn.microsoft.com/zh-cn/library/bb383977(v=vs.100).aspx. 扩展方法的意义在 ...
- linux----------ab--性能测试工具
ab.exe –n 10000 –c 100 localhost/index.php //其中-n代表请求数,-c代表并发数
- Python Thread related
1.Thread.join([timeout]) Wait until the thread terminates. This blocks the calling thread until the ...
- Adobe AIR对本地文件(XML文件)的操作
引用:http://addiwang.blog.163.com/blog/static/118130772011221114230288/ Air的文件操做主要涉及两个类,FIle和FileStrea ...
- 通过cygwin安装openSSH
openSSH的安装是学习hadoop必不可少的一步,如果ssh装不好,hadoop的安装会进行不下去.本人初学hadoop时发现以前安装ssh走了一些弯路,现在又有了一些认识,所以重写了这篇日志,供 ...
- 苹果版App开发心得
这几个月中做的工作包括网站开发.安卓App开发和苹果App开发,前两者用的语言都是我熟悉的java,故苹果知识的学习,较安卓知识的学习,多出「语言基础」一块,其他方面差不多. 之前发过安卓那篇,如感兴 ...