First from the most tricky. Irregular. Later, I know that it is not specified in their email .. Mail content part, such as: from: hrbtvu_ly
Hello, ============ e ============== Can you see that the title is Chinese, this is how to deal with it later. I The solution is to modify the getcharset (), modified: private string getcharset (string s); string s); string s1 = contenttype.getParameter "charSet"); if (S1 == null) S1 = "GB2312"; return mimeutility.javacharset (S1);} catch (exception _ex) {return "GB2312";} This is what I think the easiest way. 2. Subject or other fields are the processing of the Chinese Ming code. I provide a way I write, it is possible to unify the encoded or clear string: / ** * Return to the decoded string * / public static string getDecodeText (String EWORD) {if (eword == null) Return null; try {pattern p = pattern.compile ("= //? //? ="); matcher m = p.matcher (eword); stringbuffer sb = new Stringbuffer (); boolean result = m.find (); if (result) {while (result) {m.appendreplacement (SB, MimeUtility.DecodeExt (M.Group ())); result = m.find ();} M.Appendtail (SB); return sb.tostring ();} else {string decodevalue = new string (eword.getbytes ("ISO8859-1" ), "GBK"); return decodeValue;}}}}}}}} catch (exception e) {E.PrintStackTrace (); return eword;}} 3. Sending a message in Chinese: newmsg.setSubject (Subject, "GBK") Attachment: Base64encoder enc = new base64encoder ();