I\'m using Java Mail API and I\'m trying to send an email through Gmail\'s SMTP. How my program works: java.util.Scanner class is used to get user input - I\'m asking user f
In case if you use HTML messages, try this:
Message message = new MimeMessage(session);
message.setContent(htmlText, "text/html; charset=UTF-8");
the following charset working to me: charset=ISO-8859-1
, example:
mail.setContent(testMail.getTexto(), "text/plain; charset=ISO-8859-1");
Use the encodeText method from MimeUtility:
MimeUtility.encodeText(mail_subject, "UTF-8", "B")
(I don't know what "B" means, keep calm, and just use. Actually it can be "B" or "Q".)