Python_SMTP_smtplib.SMTPDataError: 554, smtplib.SMTPAuthenticationError: 535 错误及解决

SMTP

错误: SMTP报错 smtplib.SMTPDataError: 554, smtplib.SMTPAuthenticationError: 535 廖雪峰案例BUG

解决:

1.报错535

是因为未将POP3/SMTP服务开启。此项通过在163邮箱内 设置 获取授权码  打开,通过授权码可以进行第三方登录。此处的Password填写授权码。

2.报错554

第一种情况:缺失发件人和主题,将msg['Subject']   msg['From']  msg['To'] 几行添加。

第二种情况:网络的问题。当家里的网络出现问题时,切换成手机热点试试;当手机热点出现问题时,切换成家里的网络试试。

3

错误: smtplib.SMTPRecipientsRefused: {'1522592545@qq.com': (501, b'Error: malformed authentication response')}

解决:

malformed authentication response

畸形认证响应

修正前代码:

server.sendmail(send_user, send_user, rec_user, msg.as_string())  # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件

修正后代码:

server.sendmail(send_user, [rec_user], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件

4. socket.gaierror: [Errno 11004] getaddrinfo failed

getaddrinfo failed

获取地址信息失败

修正前

server = smtplib.SMTP_SSL("SMIP.qq.com", 465)

休整后

server = smtplib.SMTP_SSL("SMTP.qq.com", 465)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值