Answer the question
In order to leave comments, you need to log in
JavaMail readable email encoding?
Hello!!!
Please, please help!!
I am writing a program to read data from mail.
The program receives each letter and compares the header.
I always take it like this, String subject = message.getSubject();
but the trouble is that when I try to output, at least for verification, out.println(subject)
torus letters are displayed in the console with a question ???
for example: 'Order on mysite.ru' displays as '????? ?? mysite.ru'
and Yandex writes the title correctly
Answer the question
In order to leave comments, you need to log in
Decided!!!
Did it differently.
ByteArrayOutputStream output = new ByteArrayOutputStream();
message.writeTo(output);
String raw = output.toString();
int subjectIdx = raw.indexOf("Subject:");
int offIdx = raw.indexOf("\n",subjectIdx);
String sub = raw.substring(subjectIdx + 9, offIdx);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question