python中,使用MIMEApplication封装邮件附件,Outlook为什么无法收到邮件附件?,,在python中使用MI
python中,使用MIMEApplication封装邮件附件,Outlook为什么无法收到邮件附件?,,在python中使用MI
在python中使用MIMEAppliction封装附件,outlook收到此邮件时无附件。
使用MIMEBase封装附件,outlook可以收到附件。
其他客户端、网页端均正常显示,就想搞明白为什么,以后要如何取舍,在网上看到的办法都是使用MIMEApplication,对不明确的附件类型的附件进行统一包装。
两段代码如下,请教为什么?
file_mail = MIMEApplication(open(fileurl,'rb').read()) file_mail.add_header('Content-Disposition', 'attachment',filename=filename.decode('utf-8').encode('gb2312')) msg.attach(file_mail)part = MIMEBase('application', 'octet-stream') #'octet-stream': binary data part.set_payload(open(file, 'rb').read())encoders.encode_base64(part)part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(file)) msg.attach(part)
编橙之家文章,
相关内容
- 如何解决 Flask 中使用 WTForm 时自定 Button 却在页面总被
- IntegerField的值怎样赋值后刷新后会为空的?,integerfi
- 如何确定一个python爬取得网页是否是被压缩的?,pyt
- flask搭建的个人博客怎么实现markdown,flaskmarkdown,个人是
- python式的桶排序,python式桶排序,用python写了一个桶
- gunicorn 启动问题,启动不了,gunicorn不了,终端输入noh
- OPTIONS请求没有得到正常的Response Headers,responseheaders,根
- 刚开始学Python,有一句看不懂。。。,python看不懂,小弟
- 求 django 如何实现多个model返回的queryset转成 list 格式,
- scrapy的运行方式,scrapy运行方式,用scrapy做了一个程
评论关闭