Send a message | To solve many friends have used JavaMail to send mail, in the message body garbled easily resolved. But the message theme garbled no matter how the transcoding always shows a pile of garbled. What should I do with it?
The message subject in JavaMail needs to be BASE64 encoded, in the form of:
=? GB2312? b?xpq1xmpcwuvs0b6t1tjww6osx+u+ob/stcfcvkossqlq3rjew9zc66oh?=
Therefore, the direct use of Msg.setsubject ("Chinese theme"), or Msg.setsubject ("Chinese theme". GetBytes ("8859_1"), "GB2312") will appear garbled. You need to encode the byte of the subject string into the BASE64 format before you set the message subject, and add the encoding header, as shown in the sample code:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.