- Java 8 or higher
- Maven 3.6.0 or higher
-
Clone the repository:
git clone https://github.com/yichunzhao/mailhandler.git cd mailhandler
-
Build the project using Maven:
mvn clean install
-
Import Emails:
Path rootDir = Paths.get("path/to/email/directory"); MailHandler mailHandler = new MailHandler(rootDir); mailHandler.doImport(100);
-
Search Emails:
String target = "example@example.com"; Date maxDate = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss").parse("Fri Aug 25 2000 12:00:00"); List<IMailInfo> results = mailHandler.search(target, maxDate); results.forEach(e -> System.out.println(e.pretty()));
-
Sample Emails:
List<IMailInfo> samples = mailHandler.sample(20); samples.forEach(e -> System.out.println(e.pretty()));
To run the tests, use the following Maven command:
mvn test