title: Javamail don't read email multipart/related
body: <p>i have code:</p>
  
  <pre><code>Message[] arrayMessages = folderInbox.getMessages();
  
          for (int i = 0; i &lt; arrayMessages.length; i++) {
              Message message = arrayMessages[i];
              Address[] fromAddress = message.getFrom();
              String from = fromAddress[0].toString();
              String subject = message.getSubject();
              String sentDate = message.getSentDate().toString();
  
              String contentType = message.getContentType();
              String messageContent = "";
  
              // store attachment file name, separated by comma
              String attachFiles = "";
  
              if (contentType.contains("multipart")) {
                  // content may contain attachments
                  Multipart multiPart = (Multipart) message.getContent();
                  int numberOfParts = multiPart.getCount();
                  for (int partCount = 0; partCount &lt; numberOfParts; partCount++) {
                      MimeBodyPart part = (MimeBodyPart) multiPart.getBodyPart(partCount);
                      if (Part.ATTACHMENT.equalsIgnoreCase(part.getDisposition())) {
                          // this part is attachment
                          String fileName = part.getFileName();
                          attachFiles += fileName + ", ";
                          part.saveFile(saveDirectory + File.separator + fileName);
                      } else {
                          // this part may be the message content
                          messageContent = part.getContent().toString();
                      }
                  }
  
                  if (attachFiles.length() &gt; 1) {
                      attachFiles = attachFiles.substring(0, attachFiles.length() - 2);
                  }
              }else if (contentType.contains("text/plain")|| contentType.contains("text/html")) {
                  Object content = message.getContent();
                  if (content != null) {
                      messageContent = content.toString();
                  }
              }
  
              // print out details of each message
              System.out.println("Message #" + (i + 1) + ":");
              System.out.println("\t From: " + from);
              System.out.println("\t Subject: " + subject);
              System.out.println("\t Sent Date: " + sentDate);
              System.out.println("\t Typ wiadomosci: " + contentType);
              System.out.println("\t Message: " + messageContent);
              System.out.println("\t Attachments: " + attachFiles);
              System.out.println("------------------------------------------------");
          }
  </code></pre>
  
  <p>This code get email with attachment, i have problem with getting email type: multipart/related. Instead of messages i have:com.sun.mail.util.BASE64DecoderStream@f61227
  or javax.mail.internet.MimeMultipart@7612a</p>