Spring MimeMessageHelper by sending e-mail, attachments Chinese name garbled solution

1. Set System Value

 System.setProperty("mail.mime.splitlongparameters", "false");

2. Here, when the encoding format is defined to create the object (utf-8):

MimeMessageHelper helper = new MimeMessageHelper(mes, true, "utf-8");

3. Next, add attachments when you need to define attachment name is encoded

helper.addAttachment (MimeUtility.encodeWord (attachment name, "utf-8", "B"), your attachment object);

Guess you like

Origin www.cnblogs.com/dalianpai/p/12501208.html