The world's only Java-based rfc2822-compliant email address validator and parser
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml added project to TravisCI May 9, 2016
LICENSE Update Aug 15, 2017
how to release.txt

APACHE v2 License Latest Release Build Status Codacy


The world's only more-or-less-2822-compliant Java-based email address extractor / verifier

email-rfc2822-validator is available in Maven Central:


And just to show you that this stuff is hard, here's JavaMail's official parser's javadoc on the subject (line 669):

     * RFC822 Address parser.
     * XXX - This is complex enough that it ought to be a real parser,
     *       not this ad-hoc mess, and because of that, this is not perfect.
     * XXX - Deal with encoded Headers too.
    private static InternetAddress[] parse(String s, boolean strict,
				    boolean parseHdr) throws AddressException {


There are two classes available, EmailaddressValidator and EmailAddressParser. The second is used to extract data from (complex / mangled) email strings.

For both of these, you use the EmailAddressCriteria enumeration to control RFC strictness.

Here's an example for validating an email address:

boolean isValid = EmailAddressValidator.isValid(emailaddress);
boolean isValid = EmailAddressValidator.isValid(emailaddress, EmailAddressCriteria.DEFAULT);
boolean isValid = EmailAddressValidator.isValid(emailaddress, EmailAddressCriteria.RFC_COMPLIANT);
boolean isValid = EmailAddressValidator.isValid(emailaddress, EnumSet.of(ALLOW_DOT_IN_A_TEXT, ALLOW_SQUARE_BRACKETS_IN_A_TEXT));

Latest Progress


  • #7: Clarified validation modes (default vs strictly rfc compliant)

NOTE: EmailAddressValidator.isValid() now validates using EmailAddressCriteria.DEFAULT rather than EmailAddressCriteria.RFC_COMPLIANT. Use EmailAddressValidator.isValidStrict() for RFC compliant validation.


Initial release