Python通过SMTP发送邮件总是验证失败。,pythonsmtp,以下是我的代码及返回信息
Python通过SMTP发送邮件总是验证失败。,pythonsmtp,以下是我的代码及返回信息
以下是我的代码及返回信息,163和qq的都尝试过但都是验证错误,密码什么的我肯定是没有输错的。
代码:
#-*- encoding: utf-8 -*-import os, sysimport smtplibfrom smtplib import SMTP_SSLfrom email.header import Headerfrom email.mime.text import MIMEText mailInfo = { "from": "xxx@qq.com", "to": "yyy@163.com", "hostname": "smtp.qq.com", "username": "xxx@qq.com", "password": "*********", "mailsubject": "this is test", "mailtext": "hello, this is send mail test.", "mailencoding": "utf-8"} if __name__ == '__main__': smtp = SMTP_SSL(mailInfo["hostname"]) smtp.set_debuglevel(1) smtp.ehlo(mailInfo["hostname"]) smtp.login(mailInfo["username"],mailInfo["password"]) msg = MIMEText(mailInfo["mailtext"],"text",mailInfo["mailencoding"]) msg["Subject"] = Header(mailInfo["mailsubject"],mailInfo["mailencoding"]) msg["from"] = mailInfo["from"] msg["to"] = mailInfo["to"] smtp.sendmail(mailInfo["from"], mailInfo["to"], msg.as_string()) smtp.quit()
返回错误:
send: 'ehlo smtp.qq.com\r\n'reply: '250-smtp.qq.com\r\n'reply: '250-PIPELINING\r\n'reply: '250-SIZE 73400320\r\n'reply: '250-AUTH LOGIN PLAIN\r\n'reply: '250-AUTH=LOGIN\r\n'reply: '250-MAILCOMPRESS\r\n'reply: '250 8BITMIME\r\n'reply: retcode (250); Msg: smtp.qq.comPIPELININGSIZE 73400320AUTH LOGIN PLAINAUTH=LOGINMAILCOMPRESS8BITMIMEsend: 'AUTH PLAIN AGx************************************vZA==\r\n'reply: '535 Authentication failed\r\n'reply: retcode (535); Msg: Authentication failedTraceback (most recent call last): File "C:\Users\Daniel\Desktop\mail1.py", line 23, in <module> smtp.login(mailInfo["username"],mailInfo["password"]) File "C:\Python27\lib\smtplib.py", line 622, in login raise SMTPAuthenticationError(code, resp)smtplib.SMTPAuthenticationError: (535, 'Authentication failed')
拜托大家帮忙解决下我的问题!!!
编橙之家文章,
相关内容
- flask问题。,flask问题,http://www.p
- python正则表达式怎么匹配这段中文?,,下面这段文字,
- 如何处理ajax的session一致问题?,处理ajaxsession,我现在
- Windows 下 Pycharm 的正确编码设置?,windowspycharm,在 Pyc
- 微信公众号接入url验证返回"ret":-302,"err_msg":"v
- python菜鸟求助,使用matplotlib 绘制contour等高线图,z为
- 有没有满足如下要求的优先队列推荐,满足如下优先队
- 为什么用 YCM 补全 python 无法补全第三方库?,ycmpytho
- python里面声明多个变量 a = b = c = 1 这样有问题吗,pyt
- flask报了个这样的错是为什么,flask报,AttributeErr
评论关闭