我们有一个JavaMailSendersend()上失败。

这通常对我们很长一段时间都有效。只是现在我们有一个特殊的错误:

JavaMailSender故障:javax.mail.internet.ParseException:缺少“”

这是代码:

public class MailService {
    private static JavaMailSender fooMailSender;

    ...

    class FooSendMail extends Thread {
        MimeMessage message;

        FooSendMail(MimeMessage message) {
            this.message = message;
        }

        public void run() {
            try {
                fooMailSender.send(message);
            } catch (MailException e) {
                ...
            }
        }
    }
}


这是错误的堆栈跟踪:

org.springframework.mail.MailSendException: Failed messages: javax.mail.internet.ParseException: Missing '"'; message exception details (1) are:
Failed message 1:
javax.mail.internet.ParseException: Missing '"'
    at javax.mail.internet.HeaderTokenizer.readQuotedString(HeaderTokenizer.java:272)
    at javax.mail.internet.HeaderTokenizer.readToken(HeaderTokenizer.java:134)
    at javax.mail.internet.HeaderTokenizer.next(HeaderTokenizer.java:81)
    at javax.mail.internet.ParameterList.<init>(ParameterList.java:68)
    at javax.mail.internet.ContentDisposition.<init>(ContentDisposition.java:51)
    at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:580)
    at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:128)
    at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1353)
    at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1325)
    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:443)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
    at com.builde.service.MailService$FooSendMail.run(MailService.java:434)


我们无法理解问题所在。

问题是:可能是什么问题?

最佳答案

我们发现附加* .msg(Outlook邮件文件)是造成此问题的原因。

可能是JavaMailSender不支持* .msg附件

09-30 17:13