Javamail 附件中文名乱码问题

用javax.mail.internet.MimeUtility.encodeText()可以解决问题:

DataSource source = new FileDataSource(filePath);
bodyPart = new MimeBodyPart();

bodyPart.setDataHandler(new DataHandler(source));
bodyPart.setFileName(MimeUtility.encodeText(fileName));

multiPart.addBodyPart(bodyPart);

 

发表评论

电子邮件地址不会被公开。

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.