Recently there is user feedback under Mac through airmail, Outlook and so on mail client view system The title of the message is displayed as garbled, but under Windows normal.
Saved as eml via mail client, opened with sublime Text 2, can be found to show the following effects:
date:wed, 19:54:57 +0800from: < omit >to here: "=? GBK? B?zt6+za==?= "< omitted >subject here: [Mtlñð ¢Ö§³Å]ÏÎÄ¿X´Ì¬Í¨ÖªX-MAILER:SMTP-CLI 3.6, see/HTTP Smtp-cli.logix.czmessage-id: [Email protected]
Subject the Chinese content directly, and does not conform to the Mail MIME specification. Windows appears normal, but only because the system itself is well-compatible.
To encode the appropriate text, simply follow the following format:
=?charset?encoding?encoded text?=
The encoding has two optional values: Q and B, which represent the QP encoding (quoted-printable), which is BASE64 encoded.
We chose BASE64 as the coding scheme to deal with subject:
Private string Encodesubject (string subject) { byte[] base64 = Org.apache.commons.codec.binary.Base64.encodeBase64 (Subject.getbytes ()); return New String (base64)); }
After such processing, sent out of the mail subject is no longer Chinese, garbled problem will be solved.
Resources
Https://en.wikipedia.org/wiki/MIME
A case of message header garbled problem solving