docs: private String stripMailBodyEnding(String textBody) throws IOException {
          BufferedReader reader = null;
          StringBuilder body = new StringBuilder();
  
          try {
              reader = new BufferedReader(new StringReader(textBody));
  
              String line = reader.readLine();
              while (line != null && !line.equals(".")) {
                  body.append(line);
                  body.append(System.getProperty("line.separator"));
                  line = reader.readLine();
              }
          } finally {
              if (reader != null) {
                  try {
                      reader.close();
                  } catch (IOException e) {
                      log.warn("Failed to close reader", e);
                  }
              }
          }
  
          return body.toString().trim();
      }