How to setsubject in base64 encoding in mimemessage
While i send mail using javamail API i set the subject likr this
msg.setSubject(subject,charset);
But this setsubject method encode subject only in Quoted-printable encoding. But i want t开发者_如何学Co setsubject in base64 encoding.
For Example:
Expected result: =?big5?B?............?=
result obtained: =?big5?Q?.............?=
please help me. Thanks in advance
You can encode and set subject header explicitly:
message.setHeader("Subject", MimeUtility.encodeText("Тема.", "utf-8", "B"));
Result:
Subject: =?utf-8?B?0uXs4C4=?=
But notice, that if your subject has only ASCII characters, it will NOT be encoded.
message.setHeader("Subject", MimeUtility.encodeText("Subject.", "utf-8", "B"));
Result:
Subject: Subject.
精彩评论