Java Code Examples for org.apache.james.mime4j.stream.MimeConfig#DEFAULT

The following examples show how to use org.apache.james.mime4j.stream.MimeConfig#DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmailParseManager.java    From email-mime-parser with Apache License 2.0 5 votes vote down vote up
public Email getParsedEmail() throws MimeException, IOException {
	
	MimeConfig mime4jParserConfig = MimeConfig.DEFAULT;
	BodyDescriptorBuilder bodyDescriptorBuilder = new DefaultBodyDescriptorBuilder();
	MimeStreamParser mime4jParser = new MimeStreamParser(mime4jParserConfig,DecodeMonitor.SILENT,bodyDescriptorBuilder);
	mime4jParser.setContentDecoding(true);
	mime4jParser.setContentHandler(contentHandler);		
	
	mime4jParser.parse(rawEmailFile);
	
	return ((CustomContentHandler)contentHandler).getEmail();
}
 
Example 2
Source File: ParserTest.java    From email-mime-parser with Apache License 2.0 5 votes vote down vote up
private void parseEmail(String messageFileName, ContentHandler contentHandler) throws FileNotFoundException,
		MimeException, IOException {

	MimeConfig mime4jParserConfig = MimeConfig.DEFAULT;
	BodyDescriptorBuilder bodyDescriptorBuilder = new DefaultBodyDescriptorBuilder();		
	MimeStreamParser mime4jParser = new MimeStreamParser(mime4jParserConfig,DecodeMonitor.SILENT,bodyDescriptorBuilder);
	mime4jParser.setContentDecoding(true);
	mime4jParser.setContentHandler(contentHandler);
	
	URL url = this.getClass().getClassLoader().getResource(messageFileName);
	
	InputStream mailIn = new FileInputStream(new File(url.getFile()));
	mime4jParser.parse(mailIn);
	
}
 
Example 3
Source File: EmailVerificationTest.java    From email-mime-parser with Apache License 2.0 4 votes vote down vote up
private void parseEmail(String messageFileName,
                        ContentHandler contentHandler) throws
        MimeException, IOException {

    MimeConfig mime4jParserConfig = MimeConfig.DEFAULT;

    BodyDescriptorBuilder bodyDescriptorBuilder = new DefaultBodyDescriptorBuilder();
    MimeStreamParser mime4jParser = new MimeStreamParser(mime4jParserConfig, DecodeMonitor.SILENT, bodyDescriptorBuilder);

    mime4jParser.setContentDecoding(true);
    mime4jParser.setContentHandler(contentHandler);

    URL url = this.getClass().getClassLoader().getResource(messageFileName);

    InputStream mailIn = new FileInputStream(new File(url.getFile()));
    mime4jParser.parse(mailIn);

}