javamail - How to setsubject in base64 encoding in mimemessage -


When I send mail using the javamail API, I set the topic like this

Msg.setSubject (subject, charset);

But this SetJet method encoding is only in quoted-printable encoding but I want to set up the Base 64 encoding.

For example:

Expected Result: =? Big 5? B? ............? =

Get the result: =? Big5? Why? .............? =

Please help me in advance

You can specify and the topic You can explicitly set the object:

  Message.setHeader ("subject", MimeUtility.encodeText ("Тема.", "Utf-8", "B"));  

Result:

  topic: =? UTF-8? B? 0xx4c4 =? =  

But notice, if you have only ASCII characters, then it will not be encoded.

  message.setHeader ("Subject", MimeUtility.encodeText ("Subject.", "Utf-8", "B"));  

Result:

  topic: topic  

Comments