发送简单邮件时出现“无哑剧消息内容”异常
2022-09-03 17:40:48
我正在尝试使用 org.springframework.mail.javamail.JavaMailSenderImpl 发送一封非常简单的电子邮件。代码如下:
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setTo(request.getCustomerEmail());
mailMessage.setSubject("someSubject");
mailMessage.setFrom("vincent@myDomain.com");
mailSender.send(mailMessage);
这是我得到的例外:
Caused by: org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: No MimeMessage content
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:459)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
我真的不明白为什么会发生这种情况。
任何想法?