@Test void testSendMailWithMultipleMimeMessagePreparators() throws Exception { AmazonSimpleEmailService emailService = mock(AmazonSimpleEmailService.class); JavaMailSender mailSender = new SimpleEmailServiceJavaMailSender(emailService); MimeMessagePreparator[] preparators = new MimeMessagePreparator[3]; preparators[0] = mimeMessage -> { MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage); mimeMessageHelper.setTo("to@domain.com"); }; preparators[1] = mimeMessage -> { MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage); mimeMessageHelper.setSubject("subject"); }; preparators[2] = mimeMessage -> { MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage); mimeMessageHelper.setText("body"); }; ArgumentCaptor<SendRawEmailRequest> request = ArgumentCaptor .forClass(SendRawEmailRequest.class); when(emailService.sendRawEmail(request.capture())) .thenReturn(new SendRawEmailResult().withMessageId("123")); mailSender.send(preparators); MimeMessage mimeMessage = new MimeMessage(Session.getInstance(new Properties()), new ByteArrayInputStream( request.getValue().getRawMessage().getData().array())); assertThat(mimeMessage.getRecipients(Message.RecipientType.TO)[0].toString()) .isEqualTo("to@domain.com"); assertThat(mimeMessage.getSubject()).isEqualTo("subject"); assertThat(mimeMessage.getContent()).isEqualTo("body"); }
@Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); void setJavaMailProperties(Properties javaMailProperties); void setSession(Session session); void setDefaultEncoding(String defaultEncoding); void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap); @Override MimeMessage createMimeMessage(); @Override MimeMessage createMimeMessage(InputStream contentStream); @Override void send(MimeMessage mimeMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessage... mimeMessages); @Override void send(MimeMessagePreparator mimeMessagePreparator); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessagePreparator... mimeMessagePreparators); }
SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender { @Override public void send(MimeMessage mimeMessage) throws MailException { this.send(new MimeMessage[] { mimeMessage }); } SimpleEmailServiceJavaMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); void setJavaMailProperties(Properties javaMailProperties); void setSession(Session session); void setDefaultEncoding(String defaultEncoding); void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap); @Override MimeMessage createMimeMessage(); @Override MimeMessage createMimeMessage(InputStream contentStream); @Override void send(MimeMessage mimeMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessage... mimeMessages); @Override void send(MimeMessagePreparator mimeMessagePreparator); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(MimeMessagePreparator... mimeMessagePreparators);  }