View RSS Feed

Java Mail

Read Multipart mail using Java Mail

Rate this Entry
by , 04-25-2012 at 10:04 PM (2577 Views)
Multipart messages could be read by javamail api which has been shown in this example. Multipart class object is created to read the multipart mail.

For composition of mails along with attachments, Multipart mail is being used now a days. One might attach the doc, images, zip files, xls etc. Mails that could be designed nicely are created by it.

Classes are provided by the Java Mail API so that Multipart messages could be created, sent or read. Java Mail api is used for creation of the mails along with attachments, in Java technologies.

Using the Multipart Class

How Multipart class could be used is shown in given code. Firstly Multipart class object is created so that to obtain body part & read/compose emails.

Java Code:
Multipart multipart = (Multipart) msg[i].getContent();After that create BodyPart object BodyPart bodyPart = multipart.getBodyPart(x);
Then bodyPart content is read by the help of getContent() method.

Submit "Read Multipart mail using Java Mail" to Facebook Submit "Read Multipart mail using Java Mail" to Digg Submit "Read Multipart mail using Java Mail" to del.icio.us Submit "Read Multipart mail using Java Mail" to StumbleUpon Submit "Read Multipart mail using Java Mail" to Google

Categories
Mail API

Comments