Python2.5的SMTPAuthenticationError(334, 'UGFzc3dvcmQ6')
来源:互联网 发布:淘宝代付可以看出来吗 编辑:程序博客网 时间:2024/06/05 11:22
http://liguangming.com/view/780
前段时间突然发现blog的post to qzone的插件不能使用了,返回的异常如下:
File "C:/Python25/lib/smtplib.py", line 591, in login
raise SMTPAuthenticationError(code, resp)
SMTPAuthenticationError: (334, 'UGFzc3dvcmQ6')
通过抓包发现stmtp.qq.com
connect: ('smtp.qq.com', 25)
connect: ('58.251.150.237', 25)
reply: '220 Esmtp QQ Mail Server/r/n'
reply: retcode (220); Msg: Esmtp QQ Mail Server
connect: Esmtp QQ Mail Server
send: 'ehlo [192.168.1.177]/r/n'
reply: '250-esmtp.qq.com/r/n'
reply: '250-PIPELINING/r/n'
reply: '250-SIZE 52428800/r/n'
reply: '250-AUTH LOGIN/r/n'
reply: '250-AUTH=LOGIN/r/n'
reply: '250 8BITMIME/r/n'
reply: retcode (250); Msg: esmtp.qq.com
PIPELINING
SIZE 52428800
AUTH LOGIN
AUTH=LOGIN
8BITMIME
send: 'AUTH LOGIN **********/r/n'
reply: '334 VXNlcm5hbWU6/r/n'
reply: retcode (334); Msg: VXNlcm5hbWU6
send: '*****/r/n'
reply: '334 UGFzc3dvcmQ6/r/n'
reply: retcode (334); Msg: UGFzc3dvcmQ6
发现邮件服务器返回的是 AUTH=LOGIN,多了一个'=',打开smtplib.py找到
elif authmethod == AUTH_LOGIN:
(code, resp) = self.docmd("AUTH",
"%s %s" % (AUTH_LOGIN, encode_base64(user, eol="")))
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(password, eol=""))
修改为:
elif authmethod == AUTH_LOGIN:
# Three stage: 1. sent "AUTH LOGIN"; 2. sent "user name"; 3. sent "password".
(code, resp) = self.docmd("AUTH", AUTH_LOGIN)
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(user, eol=""))
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(password, eol=""))
找到
if method in authlist:
authmethod = method
break
修改为:
if method in authlist or ('=%s' % method) in authlist:
authmethod = method
break
最好是将此文件另存到你的项目文件里调用,这样就不需要换个环境就先要修改smtplib.py.
- Python2.5的SMTPAuthenticationError(334, 'UGFzc3dvcmQ6')
- Django-SMTPAuthenticationError
- python2.7和Python3.5的区别
- Python2.7与Python3.5的区别
- python2.7.2的安装
- python2.7.2的安装
- python2,3的区别
- python2.7.2的安装
- Python2 的中文注释
- 2015061206 - python2的死期
- Python2 包的安装
- python2的编码问题
- SMTPAuthenticationError 535 Error(关键词:flask/bug)
- Anaconda2下的Python2.7和Python3.5的共存
- centos配置python2.5
- Python2.5+.py解压
- 安装python2.5
- python2.5 编译出错
- 兼容IE6与IE7的无提示窗口关闭代码
- [可爱的 Python]: Python 中的函数编程
- getchar()和EOF的问题
- 独立经济体——美好的愿望
- atmega16中的1602液晶程序
- Python2.5的SMTPAuthenticationError(334, 'UGFzc3dvcmQ6')
- VMware NAT 端口映射配置
- 如何修改镜像操作系统的SID
- 优化PHP代码的40条建议
- 论FTP的主动被动和相关的防火墙设置
- 国内主流免费CMS系统介绍
- Scanner类用法
- ORACLE JOB INTERVAL参数设置
- JFreeChart多个示例