Welcome to the Mimepull project. This project provides a streaming API to access attachments parts in a MIME message. Often times, a large MIME message cannot be loaded into memory. Hence the whole message or attachment parts are written to a file system and access to the attachment parts is provided using those files.

However, in some cases, the attachment parts can be accessed by applications in a streaming fashion, provided: - The parts are accessed in the same order as they appear in the stream - The parts are accessed only once. In such situations, the parts need not be written to file system (no matter how large message it is !)

Sample Usage

// Parts are accessed in order. The data is accessed using readOnce()
// and there shouldn't be any data stored in temp files.
public void testOrder() {
    InputStream in = ...
    String boundary = ...
    MIMEConfig config = ...
    MIMEMessage mm = new MIMEMessage(in, boundary, config);

    MIMEPart partA = mm.getPart("partA");
    InputStream ais = partA.readOnce();

    MIMEPart partB = mm.getPart("partB");
    InputStream bis = partB.readOnce()

    MIMEPart partC = mm.getPart("partC");
    InputStream cis = partC.readOnce()


MIME message parsing is done using pull-parsing, much similar to StAX in XML world. The MIMEParts are constructed lazily, and parsing is triggered by applications while reading the attachment parts. MIMEConfig provides various configuration options to control parsing and storing MIME parts. It is also possible to read MIME parts in any order and multiple times, but doing so may create attachment parts on the file system. The latest implementations provide also Content-Encoding support.

Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
Please Confirm