class AWSEmailProvider implements EmailProvider {

    @Override
    public boolean sendEmail(Collection<String> recipients, String from, MimeMessage mimeMessage) {
        try {
            try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
                mimeMessage.writeTo(outputStream);
                RawMessage rawMessage = new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));
                SendRawEmailRequest rawEmailRequest = new SendRawEmailRequest(rawMessage);
                SendRawEmailResult result = ses.sendRawEmail(rawEmailRequest);
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug("Email with messageId={} sent successfully.", result.getMessageId());
                }
                return result != null;
            }
        } catch (Exception ex) {
            LOGGER.error("The email could not be sent. Error message: {}", ex.getMessage());
            return false;
        }
    }

      AWSEmailProvider();
      AWSEmailProvider(AmazonSimpleEmailService ses);

}