code: @Override
      public void close() throws Exception
      {
  
          MimeBodyPart part = new MimeBodyPart();
  
          StringBuilder sb = new StringBuilder();
  
  
          int len = buffer.length();
          for (int i = 0; i < len; i++)
          {
              ILoggingEvent event = buffer.get();
              sb.append(layout.doLayout(event));
          }
  
          part.setText(sb.toString(), "UTF-8", "plain");
  
          Multipart mp = new MimeMultipart();
          mp.addBodyPart(part);
          mimeMsg.setContent(mp);
  
          mimeMsg.setSentDate(new Date());
          Transport.send(mimeMsg);
  
      }
docs: Close the trace and send the email
  @throws Exception if an error occurs