最近发现用smtplib发邮件一直发送不成功,使用debug发现前面都正常,但是DATA发送直接被smtp服务器直接断开。smtp服务器显示body丢失。

后来发现是我加了附件,有指定文件类型:

att1["Content-Type"] = "application/octet-stream"

去掉这个指定编码,正常发送。。。

 
 

python smtplib server not connect的更多相关文章

  1. python smtplib 发送邮件简单介绍

    SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式python的smtplib提供了一种很 ...

  2. python smtplib发送邮件遇到的认证问题

    python的smtplib模块主要是用来发送邮件的,使用起来比较方便. 使用程序发送邮件只需要写以下几行代码就OK了: #!/usr/bin/env python import smtplib s ...

  3. python smtplib发email

    #!/usr/bin/env python #coding: utf-8 import smtplib from email.mime.text import MIMEText from email. ...

  4. Python 处理server返回gzip内容

    Python 如何处理server返回gzip压缩过的内容,代码如下: from StringIO import StringIOimport gzip request = urllib2.Reque ...

  5. 小测几种python web server的性能

    http://blog.csdn.net/raptor/article/details/8038476 因为换了nginx就不再使用mod_wsgi来跑web.py应用了,现在用的是gevent-ws ...

  6. Python Web Server Gateway Interface -- WSGI

    了解了HTTP协议和HTML文档,我们其实就明白了一个Web应用的本质就是: 浏览器发送一个HTTP请求: 服务器收到请求,生成一个HTML文档: 服务器把HTML文档作为HTTP响应的Body发送给 ...

  7. a simple and universal interface between web servers and web applications or frameworks: the Python Web Server Gateway Interface (WSGI).

    WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server comm ...

  8. python smtplib email

    监控系统需要触发报警邮件, 简单笔记一下的用到的库. smtplib class smtplib.SMTP([host[, port[, local_hostname[, timeout]]]]) 返 ...

  9. Python smtplib发邮件

    常用邮箱SMTP.POP3域名及其端口号 发送普通文本内容的邮件 import smtplib from email.header import Header from email.mime.text ...

随机推荐

  1. Servlet中的乱码问题及解决办法

    假设现在有个form表单,当页面中提交一个包含中文的请求时,在服务端有可能出现中文乱码问题. <!DOCTYPE html> <html> <head> <m ...

  2. keras默认配置

    使用keras后,会在用户目录下生成.keras/keras.json文件,Windows下为:C:\Users\user\.keras\keras.json,Linux下为:~/.keras/ker ...

  3. AtCoder AGC007E Shik and Travel (二分、DP、启发式合并)

    题目链接 https://atcoder.jp/contests/agc007/tasks/agc007_e 题解 首先有个很朴素的想法是,二分答案\(mid\)后使用可行性DP, 设\(dp[u][ ...

  4. POJ1990--POJ 1990 MooFest(树状数组)

    Time Limit: 1000MSMemory Limit: 30000K Total Submissions: 8141Accepted: 3674 Description Every year, ...

  5. [c++] C++多态(虚函数和虚继承)

    转自:https://www.jianshu.com/p/02183498a2c2 面向对象的三大特性是封装.继承和多态.多态是非常重要的一个特性,C++多态基于虚函数和虚继承实现,本文将完整挖掘C+ ...

  6. python-matplotlib-2

    figure的使用 x = np.linspace(-1, 1, 50) y1 = 2 * x + 1 #figure 1 plt.figure() plt.plot(x, y1) # figure ...

  7. Django的JWT机制工作流程

    https://blog.csdn.net/bin_1022/article/details/81278513 django-rest-framework-jwt token 怎么解码得到用户名? d ...

  8. AIDL 的工作原理

    当创建AIDL文件并Clean Project 代码后,会生成相应的Java文件: 先来一段伪代码:类整体结构 /* * This file is auto-generated. DO NOT MOD ...

  9. shell编程-定时删除(30天)文件

    1.创建shell touch /opt/auto-del-30-days-ago.sh chmod +x auto-del-30-days-ago.sh 2.编辑shell脚本: vi auto-d ...

  10. ExpectedConditions API

    使用 public boolean isPresent(String xpath, int waitingTimeInSec) { try { WebDriverWait wait = new Web ...