protected void parse(InputStream in) throws IOException, MessagingException { mHeader.clear(); mFrom = null; mTo = null; mCc = null; mBcc = null; mReplyTo = null; mMessageId = null; mReferences = null; mInReplyTo = null; mSentDate = null; mBody = null; MimeEntityConfig parserConfig = new MimeEntityConfig(); parserConfig.setMaxHeaderLen(-1); // The default is a mere 10k parserConfig.setMaxLineLen(-1); // The default is 1000 characters. Some MUAs generate // REALLY long References: headers MimeStreamParser parser = new MimeStreamParser(parserConfig); parser.setContentHandler(new MimeMessageBuilder()); try { parser.parse(new EOLConvertingInputStream(in)); } catch (MimeException me) { throw new Error(me); } }