code: public static void sendMessageBody(String to, String from, String subject, Object body, String contentType, ServerSetup serverSetup) {
          try {
              Session smtpSession = getSession(serverSetup);
              MimeMessage mimeMessage = new MimeMessage(smtpSession);
  
              mimeMessage.setRecipients(Message.RecipientType.TO, to);
              mimeMessage.setFrom(from);
              mimeMessage.setSubject(subject);
              mimeMessage.setContent(body, contentType);
              sendMimeMessage(mimeMessage);
          } catch (MessagingException e) {
              throw new IllegalStateException("Can not send message", e);
          }
      }
docs: Send the message with the given attributes and the given body using the specified SMTP settings
  
  @param to          Destination address(es)
  @param from        Sender address
  @param subject     Message subject
  @param body        Message content. May either be a MimeMultipart or another body that java mail recognizes
  @param contentType MIME content type of body
  @param serverSetup Server settings to use for connecting to the SMTP server