Skip to content

Pelumi/EmailReplyParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmailReplyParser

Build Status

EmailReplyParser is a small Java library for parsing plain text email content, based on GitHub's email_reply_parser library.

Installation

Run mvn clean test package. A nice and fresh EmailReplyParser-1.0.jar file will appear in the EmailReplyParser/target directory.

Example Usage

Import the Email and EmailParser classes.

import com.edlio.emailreplyparser.Email;
import com.edlio.emailreplyparser.EmailParser;

Instantiate an EmailParser object and parse your email:

EmailParser parser = new EmailParser();
Email email = parser.parse(emailString);

You get an Email object that contains a set of Fragment objects. The Email class exposes two methods:

  • getFragments(): returns a list of fragments;
  • getVisibleText(): returns a string which represents the content considered as "visible".
  • getHiddenText(): returns a string which represents the content considered as "hidden".

The Fragment represents a part of the full email content, and has the following API:

String content = fragment.getContent();

boolean isSignature = fragment.isSignature();

boolean isQuoted = fragment.isQuoted();

boolean isHiiden = fragment.isHidden();

boolean isEmpty = fragment.isEmpty();

Alternatively, you can rely on the EmailReplyParser to either parse an email or get its visible content in a single line of code:

Email email = EmailReplayParser.read(emailContentString);

String reply = EmailReplyParser.parseReply(emailContentString);

Credits

License

EmailReplyParser is released under the MIT License. See the bundled LICENSE file for details.

About

Java library to parse plain text email content

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages