Search in sources :

Example 1 with DefaultBodyFactory

use of com.fsck.k9.mail.DefaultBodyFactory in project k-9 by k9mail.

the class MimeMessage method parse.

private void parse(InputStream in, boolean recurse) throws IOException, MessagingException {
    mHeader.clear();
    mFrom = null;
    mTo = null;
    mCc = null;
    mBcc = null;
    mReplyTo = null;
    xOriginalTo = null;
    deliveredTo = null;
    xEnvelopeTo = null;
    mMessageId = null;
    mReferences = null;
    mInReplyTo = null;
    mSentDate = null;
    mBody = null;
    MimeConfig parserConfig = new MimeConfig.Builder().setMaxHeaderLen(-1).setMaxLineLen(-1).setMaxHeaderCount(-1).build();
    MimeStreamParser parser = new MimeStreamParser(parserConfig);
    parser.setContentHandler(new MimeMessageBuilder(new DefaultBodyFactory()));
    if (recurse) {
        parser.setRecurse();
    }
    try {
        parser.parse(new EOLConvertingInputStream(in));
    } catch (MimeException me) {
        throw new MessagingException(me.getMessage(), me);
    }
}
Also used : DefaultBodyFactory(com.fsck.k9.mail.DefaultBodyFactory) MimeConfig(org.apache.james.mime4j.stream.MimeConfig) MessagingException(com.fsck.k9.mail.MessagingException) MimeStreamParser(org.apache.james.mime4j.parser.MimeStreamParser) MimeException(org.apache.james.mime4j.MimeException) EOLConvertingInputStream(org.apache.james.mime4j.io.EOLConvertingInputStream)

Aggregations

DefaultBodyFactory (com.fsck.k9.mail.DefaultBodyFactory)1 MessagingException (com.fsck.k9.mail.MessagingException)1 MimeException (org.apache.james.mime4j.MimeException)1 EOLConvertingInputStream (org.apache.james.mime4j.io.EOLConvertingInputStream)1 MimeStreamParser (org.apache.james.mime4j.parser.MimeStreamParser)1 MimeConfig (org.apache.james.mime4j.stream.MimeConfig)1