Javamail changing charset of subject line

前端 未结 6 2025
旧巷少年郎
旧巷少年郎 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 20:57

    The MimeMessage.setSubject(String subject, String charset) method will solve the problem: mimeMsg.setSubject(subject,"utf-8");

    This is an updated link. Previous documentation link was dismissed by Oracle after Oracle bought the Sun.

提交回复
热议问题