docs: public Email getEmail(CmsObject cms, I_CmsNewsletterRecipient recipient) throws CmsException {
  
          StringBuffer htmlMsg = new StringBuffer(1024);
          StringBuffer txtMsg = new StringBuffer(1024);
          Iterator<I_CmsNewsletterContent> contents = m_contents.iterator();
          while (contents.hasNext()) {
              I_CmsNewsletterContent content = contents.next();
              if (recipient.isSubscriber(content)) {
                  if (content.getType().equals(CmsNewsletterContentType.TYPE_HTML)) {
                      htmlMsg.append(content.getContent());
                  } else {
                      txtMsg.append(content.getContent());
                  }
              }
          }
          Email email = null;
          try {
              if ((htmlMsg.length() > 0) || !m_attachments.isEmpty()) {
                  // we need to create a HTML mail
                  CmsHtmlMail htmlMail = new CmsHtmlMail();
                  htmlMail.setHtmlMsg(replaceMacros(htmlMsg.toString(), recipient));
                  Iterator<CmsResource> attachments = m_attachments.iterator();
                  while (attachments.hasNext()) {
                      CmsResource resource = attachments.next();
                      // set the description of the attachment either to the
                      // property description, if it is set, or
                      // to the property title
                      String description = "";
                      String propertyDescription = cms.readPropertyObject(
                          cms.getSitePath(resource),
                          CmsPropertyDefinition.PROPERTY_DESCRIPTION,
                          true).getValue();
                      if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(propertyDescription)) {
                          description = propertyDescription;
                      } else {
                          String propertyTitle = cms.readPropertyObject(
                              cms.getSitePath(resource),
                              CmsPropertyDefinition.PROPERTY_TITLE,
                              true).getValue();
                          description = propertyTitle;
                      }
                      htmlMail.attach(new CmsVfsDataSource(cms, resource), resource.getName(), description);
                  }
                  htmlMail.setTextMsg(replaceMacros(txtMsg.toString(), recipient));
                  email = htmlMail;
              } else {
                  // only text content, return text mail
                  CmsSimpleMail textMail = new CmsSimpleMail();
                  textMail.setMsg(replaceMacros(txtMsg.toString(), recipient));
                  email = textMail;
              }
              email.addTo(recipient.getEmail());
              email.setSubject(m_subject);
          } catch (EmailException e) {
              LOG.error(Messages.get().getBundle().key(Messages.LOG_COMPOSE_MAIL_ERR_0), e);
          }
          return email;
      }