Chinaunix

标题: python发送邮件附件,outlook2013显示未命名附件.dat [打印本页]

作者: sunjushi    时间: 2017-12-07 15:43
标题: python发送邮件附件,outlook2013显示未命名附件.dat
python发送附件关键部分代码如下:


  1. # 构造附件
  2.         att1 = MIMEApplication(open(r'/app/script/idc_access_record/1.docx', 'rb').read())
  3.         att1.add_header('Content-Disposition', 'attachment', filename=('gbk','','机房访问申请表.docx'))
  4.         msg.attach(att1)
复制代码


用户接收到后其他邮箱客户端都显示正常,但就同事用的outlook2013客户端接收后显示“未命名附件.dat”,而其web端也接收正常。如下




求助:有谁知道这种问题如何解决吗?

作者: q1208c    时间: 2017-12-08 00:09
编码换成 unicode 或 utf-8 试试。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2