python发送邮件,文件后缀变成了bin
问题:在用python做自动化测试时,将html测试报告在邮件中添加文件发送的过程中,发现发送成功后,文件的后缀为.bin
解决方法:
加一行代码
msg_att["Content-Disposition"] = 'attachment; filename="' + filename
顺便分享一下fiename的命名
now_time = time.strftime('%Y-%m-%d %H:%M:%S') filename = 'report'+now_time+'.html'

浙公网安备 33010602011771号