Answer the question
In order to leave comments, you need to log in
How to deal with the message encoding in JavaMail?
I can't figure out the encoding in the subject line.
I do it like this:
message.setSubject("Тема сообщения", "utf-8");
message.setContent("Текст сообщения","text/plain;charset=utf-8");
message.setHeader("Content-Type", "text/plain; charset=utf-8");
Date timeStamp = new Date();
message.setSentDate(timeStamp);
Transport.send(message);
Answer the question
In order to leave comments, you need to log in
Try to remove
message.setHeader("Content-Type", "text/plain; charset=utf-8");
try adding something like this
message.setHeader("Content-Transfer-Encoding", "base64");
Are you sure the source code is in UTF-8? Otherwise, you can write a string in cp1251, and JavaMail says that it is UTF-8. Whether it is not enough - check just in case. And then the implementation of MimeMessage.setSubject () is very simple. It's hardly because of her.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question