Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2434|回复: 0
打印 上一主题 下一主题

对mime内容 何时使用quoted-printable编码 何时使用 base64

[复制链接]

165

主题

269

帖子

957

积分

认证用户组

Rank: 5Rank: 5

积分
957
跳转到指定楼层
楼主
发表于 2017-1-12 19:22:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 firemail 于 2017-1-13 11:38 编辑

对mime内容 何时使用quoted-printable编码 何时使用 base64编码?


Would using Content-Transfer-Encoding: base64 for text and html email present any issues?

http://stackoverflow.com/questio ... ml-email-present-an

I'm working on an email project. For reasons that I will not go into here, doing quoted-printable encoding on long email messages is problematic in the customer's environment.
Doing base64-encoding on the HTML and text sections of the SMTP emails we are sending seems like a viable option. In testing it, it seems to work just fine in a couple test clients (like Gmail).
However I'm wondering if this will present any issues across different email clients. From reading the RFC specs, it looks like base64 is a compliant encoding for text sections, but it's unusual enough for text & html sections that I'd like to know if there will be any potential issues to consider.
Things that seem like problematic possibilities:
  • perhaps some older or less robust clients don't expect base64 in text or HTML email sections, and will fail to encode it
  • perhaps some email clients do a preview or search based on the raw content, so recipients would see base64 instead of the actual content
  • perhaps base64 could negatively influence deliverability/spam scoring?
Does anybody have experiences they can share? This seems like a good solution but I'd like to make sure I'm not missing something.



This is hard to answer -- yes, quoted-printable is used more often simply because it wastes less bytes and because the raw text of the mail body part resembles the decoded output. There is nothing which forbids using base64 for the textual message parts, though.


Thanks for your thoughts. Another data point I found which makes me feel that Base64 is an acceptable solution: if you paste high-ascii characters like smart quotes into Gmail, then send the email, Google encodes the text/plain segment using Base64.


The overhead of Base64 is constant: 1.33 the size of original data. But the overhead of QP depends on your mail language (assuming utf-8). If all your mail are in English (ASCII compatible), QP brings little overhead. For non-ASCII chars, QP-encoded data is 3 times the size of original one. If your mail is in East Asian languages like Chinese, Japanese and Korean, Base64 is more efficent than QP.


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-11-26 01:43 , Processed in 0.056448 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表