Search code examples
javaemailemail-validation

EmailValidation (email address) with RFC3696


I look for an email validator accepted the email address in the rfc3696 standard (who accepted the accents in the email). I try ( org.apache.commons.validator.routines.EmailValidator) "commons-validator 1.4.0" but this validator does not accept accents.

I want a java api to validates an email address according to standard rfc3696. Ex Valid Email address : Loïc.Accentué@voilà.fr

Thanks in advance.


Solution

  • I think the best solution to validate email address is parse email with JavaMail.

    public static boolean isValidEmailAddress(String emailAddress) {
       try {
           InternetAddress.parse(emailAddress, true);
           return true;
       } catch (Exception e) {
        return false;
       }
    
    }