code: @Override
      public MultiPartEmail createMultiPartEmailWithContent(Mail mail) throws EmailException {
  
          MultiPartEmail multiPartEmail;
  
          // set if it is a txt or html mail:
  
          if (mail.getBodyHtml() == null || mail.getBodyHtml().equals("")) {
  
              multiPartEmail = new MultiPartEmail();
              multiPartEmail.setMsg(mail.getBodyText());
  
          } else if (mail.getBodyText() == null || mail.getBodyText().equals("")) {
              multiPartEmail = new HtmlEmail().setHtmlMsg(mail.getBodyHtml());
          } else {
              multiPartEmail =
                      new HtmlEmail().setHtmlMsg(mail.getBodyHtml()).setTextMsg(mail.getBodyText());
          }
  
          // and return the nicely configured mail:
          return multiPartEmail;
      }
docs: Creates a MultiPartEmail. Selects the correct implementation
  regarding html (MultiPartEmail) and/or txt content or both.
  
  Populates the mutlipart email accordingly with the txt / html content.