Java Mail API - Encoding problems

前端 未结 9 1407
野趣味
野趣味 2020-12-31 11:14

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

9条回答
  •  醉酒成梦
    2020-12-31 11:27

    You should use setText(String text, String charset) or setText(String text, String charset, String subtype) to set the text body with a specific encoding.

    MimeUtility.encodeText() is not meant for body text, but only for encoded text in headers (and then only for headers set with setHeader or addHeader).

提交回复
热议问题