当前位置: 移动技术网 > IT编程>脚本编程>Python > python编程,排除163邮箱发送邮件报错(AttributeError: ‘tuple‘ object has no attribute ‘encode‘)

python编程,排除163邮箱发送邮件报错(AttributeError: ‘tuple‘ object has no attribute ‘encode‘)

2020年07月03日  | 移动技术网IT编程  | 我要评论

python编程学习,排除163邮箱发送邮件报错(AttributeError: ‘tuple’ object has no attribute ‘encode’

AttributeError: 'tuple' object has no attribute 'encode'

根据提示初步判断跟类型或者编码有关。

在网上查找到了第一种解决方案:

使用join方法解决,确实有效。

to_addr = ["xxxxxxxxx@163.com", "xxxxxxxxx@qq.com"]
msg['To'] = ','.join(to_addr)

通过打印生成结果,思考第二种解决途径:

直接输入***一整个字符串 ***,中间以逗号分割。经测试成功发送。

msg['To'] = "xxxxxxxxx@163.com, xxxxxxxxx@qq.com"

多说一句吧。发邮件的时候,邮箱本身会进行一些限制,要学会查看错误手册!

本文地址:https://blog.csdn.net/qq_40674586/article/details/107056128

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网