When I compile my application into a native image there is an error when I use JavaMailSender in multipart mode. When running locally on java 17/JVM it works fine, but since compiling into a native image it is not working.
GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08) spring-boot version: 3.0.1 maven: 3.8.4
Error ```org.springframework.mail.MailSendException: Failed messages: jakarta.mail.MessagingException: IOException while sending message; nested exception is: jakarta.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_864070597.1673946076742"; message exceptions (1) are: Failed message 1: jakarta.mail.MessagingException: IOException while sending message; nested exception is: jakarta.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_864070597.1673946076742"
Code
MimeMessage mimeMessage = javaMailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true, StandardCharsets.UTF_8.name());
Context context = new Context();
context.setVariable("introduction", "Welcome");
context.setVariable("contactForm", contactForm);
context.setVariable("logo", "logo");
String process = templateEngine.process("mail/email-confirmation", context);
helper.setSubject("Hi " + contactForm.name);
helper.setText(process, true);
helper.setTo(contactForm.email);
helper.addInline("logo", new ClassPathResource("static/images/jackb.png"), "image/png");
javaMailSender.send(mimeMessage);
```
Comment From: wilkinsona
Multipart is not yet covered by a released version of the Graal Reachability Metadata. See https://github.com/oracle/graalvm-reachability-metadata/pull/160 for details.