firemail

标题: 对mime内容 何时使用quoted-printable编码 何时使用 base64 [打印本页]

作者: firemail    时间: 2017-1-12 19:22
标题: 对mime内容 何时使用quoted-printable编码 何时使用 base64
本帖最后由 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:
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.







欢迎光临 firemail (http://www.firemail.wang:8088/) Powered by Discuz! X3