The charset can be specified in a system property. If no default value is specified there, you should set it explicitly. I think setSubject()
or setText()
could work.
Reference: UTF-8 charset doesn't work with javax.mail
Another approach would be to convert the FileInputStream
to a string
and create a MimeMessage
from it.
Reference: How do I read / convert an InputStream into a String in Java?