mailgun 发邮件时会自动忽略点中文名的附件

2019-04-20 21:36:07 +08:00
 aneureka

已经给 mailgun 提工单的,不知道大家遇到过这个问题没有…有没有比较好的解决方案。

2155 次点击
所在节点    全球工单系统
3 条回复
ninja911
2019-04-20 23:36:23 +08:00
我猜你是发给腾讯 QQ 邮箱的吧。不是 Mailgun 的问题。是腾讯的问题。
当你的单个附件文件名超过 6 个字时(不管中文还是英文),可以尝试附件名称命名
```
$newName = '=?UTF-8?B?'. base64_encode($attachFileName) . '?=';
```

反正我是这样解决的。
aneureka
2019-04-21 09:28:47 +08:00
@ninja911 不是的,好像发给所有邮箱都这样…可能是 content-type 的问题吧。。
aneureka
2019-04-21 17:37:51 +08:00
这个是 Mailgun 给我的回复,貌似他们也遇过这问题然后解决不了…

Hello xxx,

Thank you for the update and clarification!

I first came across this issue a couple of years ago, and unfortunately, I still have not been able to find a solution with Python.

The issue stems from how Python attempts to handle Unicode and byte strings. Python has been the only language I've struggled with this matter. The only solution would be to use the ASCII equivalent of the filename and submit the data with the POST request.

Reference: https://stackoverflow.com/questions/20591599/why-arent-post-names-with-unicode-sent-correctly-when-using-multipart-form-data

I apologize for any inconvenience this may cause. Let us know if you have any questions.

Thank you,
Marco@MG

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/557123

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX