Parsing email file with mime4J

1.5k views Asked by At

I found this example for parsing an email: http://www.mozgoweb.com/posts/how-to-parse-mime-message-using-mime4j-library/

But the example is not working, because import org.apache.james.mime4j.message.Message; is not working.

How can I create a Message from a file?

 MessageImpl mimeMsg = new MessageImpl();
 //Get some standard headers
 System.out.println("To: " + mimeMsg.getTo().toString());
 System.out.println("From: " + mimeMsg.getFrom().toString());
 System.out.println("Subject: " + mimeMsg.getSubject());
1

There are 1 answers

9
Garry On BEST ANSWER

You need this jar in your classpath:

http://central.maven.org/maven2/org/apache/james/apache-mime4j/0.6.1/apache-mime4j-0.6.1.jar

Dependency For maven:

<dependency>
    <groupId>org.apache.james</groupId>
    <artifactId>apache-mime4j</artifactId>
    <version>0.7.2</version>
</dependency>