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
The following worked for me:
MimeMessage message = ... message.setSubject(subject, "UTF-8"); message.setContent(body, "text/plain; charset=UTF-8");
Where subject and body are regular String objects with no special treatment (code and user interface use UTF-8).
subject
body