Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java class for reading mbox files and dependent jars.
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 not shown.
Binary file not shown.