摘要: 发送的是带附件的邮件,发送完成后,去检查发现,附件变成二进制文件了 出错的代码主要是这一句: att1["Content-Disposition"] = 'attachment; filename="test.txt"' 只要改正这里就可以了 问题代码 att1 = MIMEText(open('t 阅读全文
posted @ 2021-04-23 01:09 十一的杂文录 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 设置抄送人,非常简单,只需要添加一条信息就可以了,例: cc_list = ['xx@xxx.cn', 'xx@xxx.cn'] msg['Cc'] = ','.join(cc_list) smtp.sendmail(name, to_list + cc_list, msg.as_string()) 阅读全文
posted @ 2021-04-23 01:00 十一的杂文录 阅读(3379) 评论(0) 推荐(1) 编辑
摘要: 在使用腾讯企业邮箱发送邮件时出现报错:AttributeError: 'list' object has no attribute 'encode' 原因:收件人不能用列表存储数据,需要转为字符串,以逗号分割 解决方法: 将收件人列表转为字符串,以逗号分割 to_list = ['a@xx.com' 阅读全文
posted @ 2021-04-23 00:53 十一的杂文录 阅读(5299) 评论(0) 推荐(0) 编辑