@Test void testSendSimpleMailWithCCandBCC() throws Exception { AmazonSimpleEmailService emailService = mock(AmazonSimpleEmailService.class); SimpleEmailServiceMailSender mailSender = new SimpleEmailServiceMailSender( emailService); SimpleMailMessage simpleMailMessage = createSimpleMailMessage(); simpleMailMessage.setBcc("bcc@domain.com"); simpleMailMessage.setCc("cc@domain.com"); ArgumentCaptor<SendEmailRequest> request = ArgumentCaptor .forClass(SendEmailRequest.class); when(emailService.sendEmail(request.capture())) .thenReturn(new SendEmailResult().withMessageId("123")); mailSender.send(simpleMailMessage); SendEmailRequest sendEmailRequest = request.getValue(); assertThat(sendEmailRequest.getSource()).isEqualTo(simpleMailMessage.getFrom()); assertThat(sendEmailRequest.getDestination().getToAddresses().get(0)) .isEqualTo(simpleMailMessage.getTo()[0]); assertThat(sendEmailRequest.getMessage().getSubject().getData()) .isEqualTo(simpleMailMessage.getSubject()); assertThat(sendEmailRequest.getMessage().getBody().getText().getData()) .isEqualTo(simpleMailMessage.getText()); assertThat(sendEmailRequest.getDestination().getBccAddresses().get(0)) .isEqualTo(simpleMailMessage.getBcc()[0]); assertThat(sendEmailRequest.getDestination().getCcAddresses().get(0)) .isEqualTo(simpleMailMessage.getCc()[0]); }
@Override public void send(SimpleMailMessage simpleMailMessage) throws MailException { send(new SimpleMailMessage[] { simpleMailMessage }); }
SimpleEmailServiceMailSender implements MailSender, DisposableBean { @Override public void send(SimpleMailMessage simpleMailMessage) throws MailException { send(new SimpleMailMessage[] { simpleMailMessage }); } }
SimpleEmailServiceMailSender implements MailSender, DisposableBean { @Override public void send(SimpleMailMessage simpleMailMessage) throws MailException { send(new SimpleMailMessage[] { simpleMailMessage }); } SimpleEmailServiceMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); }
SimpleEmailServiceMailSender implements MailSender, DisposableBean { @Override public void send(SimpleMailMessage simpleMailMessage) throws MailException { send(new SimpleMailMessage[] { simpleMailMessage }); } SimpleEmailServiceMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); @Override void send(SimpleMailMessage simpleMailMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(SimpleMailMessage... simpleMailMessages); @Override final void destroy(); }
SimpleEmailServiceMailSender implements MailSender, DisposableBean { @Override public void send(SimpleMailMessage simpleMailMessage) throws MailException { send(new SimpleMailMessage[] { simpleMailMessage }); } SimpleEmailServiceMailSender(
			AmazonSimpleEmailService amazonSimpleEmailService); @Override void send(SimpleMailMessage simpleMailMessage); @SuppressWarnings("OverloadedVarargsMethod") @Override void send(SimpleMailMessage... simpleMailMessages); @Override final void destroy();  }