#-*-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的更多相关文章

  1. Cannot send, channel has already failed:

    背景: 一个同事往这个队列发数据,另一个同事从这个队列取数据,进行解析. 这是昨天同事昨天消费者 消费activemq 队列,一开始有正常,运行了一段时间后,发现突然消费者变为零了.因为有监控.之后怎 ...

  2. org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed

    项目是使用activeMQ 发布订阅的模式,在本地测试正常,但是 放到服务器上出现这个错误: org.apache.activemq.transport.InactivityIOException: ...

  3. Send [1] times, still failed

    com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [696094] ...

  4. 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 ...

  5. UiPath: Send SMTP Mail Message 发送带附件的邮件

    Tips:关于Hotmail的server和port的获取方式,请参考以下链接 https://support.office.com/en-us/article/Server-settings-you ...

  6. PHP系列 | PDO::prepare(): send of 68 bytes failed with errno=32 Broken pipe

    设计场景 1.开启Redis的键空间过期事件(键过期发布任务),创建订单创建一个过期的key,按照订单号为key,设置过期时间. 2.通过Redis的订阅模式(持久阻塞),获取到订单号进行组装. 3. ...

  7. 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:/ ...

  8. CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案

    按照 http://www.1207.me/archives/209.html 的教程安装Scrapy出现了上述错误,但是本身机器已经有了gcc,所以应该是安装包的问题 百度又看到了同博客里的解决方案 ...

  9. Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 解决办法

    今天在Ubuntu16.04 上安装python包的时候,出现了这个坑爹的问题: 解决办法,内容总结如下 情况是这样,报错是因为没有把依赖包安装全,报错情况如下图: 解决办法,先安装一些必须的依赖: ...

随机推荐

  1. Linux下查看Nginx安装目录、版本号信息?

    Linux环境下,怎么确定Nginx是以那个config文件启动的? 输入命令行: ps  -ef | grep nginx 摁回车,将出现如下图片: master process 后面的就是 ngi ...

  2. object_id用法

    特别是在建表建存储过程的时候进场会写到: IF OBJECT_ID('Table_Test','U') IS NOT NULL DROP TABLE Table_Test 这种方式代替了以往所使用的 ...

  3. 【皇甫】☀ TreeSet

    -Set: 元素是无序(存入和取出的顺序不一致),元素不可以重复 |-- HashSet: 底层数据结构是哈希表 HashSet是如何保证元素的唯一性的呢? 是通过元素的两个方法,hashCode和e ...

  4. PHP $_SERVER详解

    $_SERVER['HTTP_ACCEPT_LANGUAGE']//浏览器语言 $_SERVER['REMOTE_ADDR'] //当前用户 IP . $_SERVER['REMOTE_HOST'] ...

  5. java插入排序

    /** * 插入排序 * @param a * @date 2016-10-8 * @author shaobn */ public static void insertSort(int[] a){ ...

  6. paper 119:[转]图像处理中不适定问题-图像建模与反问题处理

    图像处理中不适定问题 作者:肖亮博士 发布时间:09-10-25 图像处理中不适定问题(ill posed problem)或称为反问题(inverse Problem)的研究从20世纪末成为国际上的 ...

  7. Ubuntu14.04台式机r8169有线网卡驱动问题

    由于台式在安装了Ubuntu14.04后插入网线后灯不亮,不能使用有线网. 查找资料发现原来是网卡驱动问题,解决办法如下: 1.查看网卡驱动名称 lspci -v 找到以太网连接的kernel dri ...

  8. 【原创】如何用Android Studio断点安卓自带Service或Bind类型的Service

    很久以来,我一直想找一种方法来断点调试安卓系统自身的Service,或者bind类型的Service,比如我想看WifiManager里面的getWifiApConfiguration函数是如何实现的 ...

  9. rdesktop共享剪贴板的问题

    使用-r clipboard:PRIMARYCLIPBOARD参数来共享剪贴板,连接到window7 但有时就不好用了,剪贴板没有同步 找到一些相关的资料 https://bugs.launchpad ...

  10. 误用的volatile

    在嵌入式编程中,有对某地址重复读取两次的操作,如地址映射IO.但如果编译器直接处理p[0] = *a; p[1] = *a这种操作时,往往会忽略后一个,而直接使用前一个已计算的结果.这是有问题的,因为 ...