code: private void checkMessage(Message msg) throws MessagingException {
          if (msg == null) {
              throw new MessagingException("Message is null");
          }
          if (!(msg instanceof MimeMessage)) {
              throw new MessagingException(
                      "AWS Mail Service can only send MimeMessages");
          }
      }
docs: Checks that the message can be sent using AWS Simple E-mail Service.