Javamail changing charset of subject line

前端 未结 6 2134
旧巷少年郎
旧巷少年郎 2021-02-13 20:28

I am using Javamail (javax.mail) to send mails. I successfully adjusted contents of my mail as utf-8. However I could not set subject line as a utf-8 encoded string.

I t

6条回答
  •  半阙折子戏
    2021-02-13 21:21

    Problem solved!

    mail.setSubject(MimeUtility.encodeText(subject, "utf-8", "B"));
    

    solves it and sends utf-8 encoded mail subjects.

    Why there is that "B" why there isn't ISO-something?

提交回复
热议问题