Skip to content

Commit

Permalink
Java class for reading mbox files and dependent jars.
Browse files Browse the repository at this point in the history
  • Loading branch information
lintool committed Oct 16, 2016
1 parent 642af42 commit f993005
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ReadMbox.java
@@ -0,0 +1,24 @@
import java.io.*;
import java.util.*;
import javax.mail.*;

public class ReadMbox {

public static void main(String[] args) throws Exception {
Session session = Session.getDefaultInstance(new Properties());
Store store = session.getStore(new URLName("mbox:"));
store.connect();

Folder inbox = store.getFolder(args[0]);
inbox.open(Folder.READ_ONLY);
Message[] messages = inbox.getMessages();
System.out.println("Number of messages: " + messages.length);

for (int i=0, n=messages.length; i<n; i++){
System.out.println(i + ": " + messages[i].getSubject());
}

inbox.close(false);
store.close();
}
}
Binary file added lib/javax.mail-1.5.6.jar
Binary file not shown.
Binary file added lib/mbox.jar
Binary file not shown.

0 comments on commit f993005

Please sign in to comment.