Getting message parts

Top  Previous  Next

A MIME message may contain 0 or more parts, each of which is a MIME message that may also contain zero or more parts.  You may get the parts for a MIME message using the MimeMessage#getParts method.  This will return a java.util.Enumeration of MimeMessage.

 

Example

 

// get all parts

Enumeration e = msg.getParts();

 

// loop thru all parts

while(e.hasMoreElements()) {

  // get next part

  MimeMessage message = (MimeMessage)e.nextElement();

 

  // print message contents to console

  System.out.println(new String(message.getMessage()));

}

 

 





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC