有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java此消息使用InternetService不支持的字符集?

我使用SpringJavaMailSender从我们的web应用程序发送邮件。到目前为止,它工作得很好,除了以下情况:我们的一位客户报告说,他们的电子邮件客户端无法读取电子邮件中的字符,并显示:

This message uses a character set that is not supported by the Internet Service. To view the original message content, open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set.

奇怪的是,只有一个人看到了这个错误。其他人看电子邮件很好。有问题的用户正在使用Hotmail

我搜索了几个论坛,大多数论坛都是关于沮丧的客户关于他们的电子邮件客户端的,但没有太多的解决方案/服务器端解决方案。有人说这是因为SMTP服务器不支持Unicode,但我不认为是这样

以下是我的(简化)代码:

MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(new InternetAddress("abc@abc.abc","Hoang Long"));
helper.setReplyTo("abc@abc.abc");
helper.setTo(student.getEmail());           
helper.setSubject(emailSubject);
helper.setCc(studioParameterService.getAllCCEmailAddress(studio.getId()));
helper.setSentDate(new Date());
helper.setText(emailContent, true);

for (String filePath : attachFileList) {
FileSystemResource attachFile = new FileSystemResource(filePath);
   helper.addAttachment(attachFile.getFilename(), attachFile);
}           
mailSender.send(helper.getMimeMessage());

共 (0) 个答案