All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.enonic.xp.mail.EmailValidator Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.mail;

import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;

/**
 * Validate that the email address conforms to the syntax rules of RFC 822.
 */
public final class EmailValidator
{
    public static boolean isValid( final String email )
    {
        try
        {
            InternetAddress emailAddress = new InternetAddress( email );
            emailAddress.validate();
            return true;
        }
        catch ( AddressException ex )
        {
            return false;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy