# #构造附件 attachment = MIMEText(open('tmp.xls', 'rb').read(), 'base64', 'utf-8') attachment["Content-Type"] = 'application/excel' attachment["Content-Disposition"] = 'attachment; filename="{0}.xls"'.format(excel_info.encode('gbk'))