python2.7发送邮件失败之——SMTPAuthenticationError问题
使用python2.7发送邮件,代码如下:
from email.header import Header
from email.mime.text import MIMEText
import smtplib
#发送邮箱
sender='yq_test@126.com'
password='123456'
#接受邮箱
receiver='41618174@qq.com'
smtpserver='smtp.126.com'
subject='python email test'
msg=MIMEText('下雨了,大家关好窗户','plain','utf-8')
msg['Subject']=Header(subject,'utf-8')
msg['From']=sender
msg['to']=receiver
try:
smtp=smtplib.SMTP()
smtp.connect(smtpserver)
smtp.login(sender,password)
smtp.sendmail(sender,receiver,msg.as_string())
smtp.quit()
print "邮件发送成功"
except smtplib.SMTPException:
print "Error:无法发邮件"
运行时提示:SMTPAuthenticationErro错误,解决办法:
1、邮箱服务器是否正确:smtp.163.com、smtp.qq.com、smtp.126.com等
2、SMTPserver是SMTP邮件服务器SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,故发送邮箱需要开启SMTP服务,邮箱服务器才能认证成功。一般在邮箱网页版本的设置界面:

3、如果以上设置成功还提示认证错误,那检查你发送邮箱的用户名和密码是否设置正确。
各位看官,看完后不要忘了为我乐于分享的精神点个赞哦,您的支持是我不断进步动力,谢谢
python2.7发送邮件失败之——SMTPAuthenticationError问题的更多相关文章
- python2.7发送邮件失败之——邮箱安全问题
使用python2.7发送邮件,通过脚本调试,脚本运行通过成功发出了邮件,但是目标邮箱qq没有收到. 刚开始怀疑脚本问题,上网查找资料后,发现邮箱发送成功后目标邮件没有收到有可能有以下几种原因: 1. ...
- python2.7发送邮件失败之——代码问题
使用python2.7发送邮件,代码如下: from email.header import Headerfrom email.mime.text import MIMETextimport smtp ...
- python通过SMTP发送邮件失败,报错505/535
python通过SMTP发送邮件失败:错误1:smtplib.SMTPAuthenticationError: (550, b'User has no permission') 我们使用pyth ...
- JDK1.8导致发送邮件失败
问题:本地JDK1.6测试可以发送邮件,但是linux上jdk1.8发送邮件失败.报错: Sending the email to the following server failed : smtp ...
- Linux SendMail发送邮件失败诊断案例(三)
一Linux服务器突然发送不出邮件,检查了很多地方都没有发现异常,检查/var/log/maillog发现如下具体信息: Apr 12 00:36:04 mylinux sendmail[4685]: ...
- (转)解决jdk1.8中发送邮件失败(handshake_failure)问题
解决jdk1.8中发送邮件失败(handshake_failure)问题 作者 zhisheng_tian 2016.08.12 22:44* 字数 1573 阅读 2818评论 6喜欢 9 暑假在家 ...
- Linux SendMail发送邮件失败诊断案例(四)
最近又碰到一起Linux下SendMail发送邮件失败的案例,邮件发送后,邮箱收不到具体邮件, 查看日志/var/log/maillog 发现有"DSN: User unknown" ...
- C# 使用 SmtpClient.SendAsync 方法发送邮件失败,总是返回 Cancelled
问题: 调用 SmtpClient.SendAsync,在 SendCompleted 的回调函数里面总是获取到 e.Cancelled 为 true. 后来测试了一下,相同的代码,只是把 SmtpC ...
- Jenkins 邮件配置 || Jenkins 发送邮件失败,提示:Error sending to the following VALID addresses
jenkins---系统管理---系统设置 在Jenkins URL下填写URL链接 在系统管理员邮件地址下填写发件邮箱,这将是以后发送邮件通知的发件人 如果下载了外部邮件通知 配置一下SMTP se ...
随机推荐
- tomcat架构分析及配置详解
浏览器访问服务器的流程 请求发起的过程: 注意:浏览器访问服务器使用的是http协议,http是应用层协议,而具体传输还是使用的TCP/IP协议 Tomcat系统总架构 2.1 Tomcat请求处理过 ...
- LuoguB2106 矩阵转置 题解
Content 给定一个 \(n\times m\) 的矩阵 \(A\),求其转置 \(A^\text T\). 数据范围:\(1\leqslant n,m\leqslant 100\). Solut ...
- ss命令用来显示处于活动状态的套接字信息。
ss命令用来显示处于活动状态的套接字信息.ss命令可以用来获取socket统计信息,它可以显示和netstat类似的内容.但ss的优势在于它能够显示更多更详细的有关TCP和连接状态的信息,而且比net ...
- axios 高级封装
import axios from 'axios'; import qs from 'qs'; const Unit = { async getApi(ajaxCfg){ let data = awa ...
- JAVA获取文件byte数组并输出进行展示和文件下载
/** * 文件下载 */ @GetMapping(value = "/download") public void download(HttpServletResponse re ...
- Spring Boot定时任务配置
import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.a ...
- 【LeetCode】237. Delete Node in a Linked List 解题报告 (Java&Python&C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 设置当前节点的值为下一个 日期 [LeetCode] ...
- 【LeetCode】389. Find the Difference 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 方法一:字典统计次数 方法二:异或 方法三:排序 日 ...
- 【LeetCode】350. Intersection of Two Arrays II 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 解题方法 Java排序+双指针 Python排序+双指针 Python解 ...
- 【LeetCode】652. Find Duplicate Subtrees 解题报告(Python)
[LeetCode]652. Find Duplicate Subtrees 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博 ...