public class EmailAddressValidator extends Object
Constructor and Description |
---|
EmailAddressValidator() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isValid(String email)
Validate the specified e-mail address.
|
static void |
validateICTPlatform(String email)
If the specified email address is not compatible with the rules below an
AddressException is thrown. |
static void |
validateRFC5322(String email)
If the specified email address is not compatible with the RFC5322 regular
expression an
AddressException is thrown. |
static void |
validateRFC822(String email)
If the specified email address is not compatible with the RFC822 rules an
AddressException is thrown. |
public static final Logger logger
public static boolean isValid(String email)
email
- the email address to validate.true
if the email address is valid, false
otherwise.public static void validateRFC822(String email) throws javax.mail.internet.AddressException
AddressException
is thrown.email
- the email address to validate.javax.mail.internet.AddressException
- thrown on validation error.public static void validateRFC5322(String email) throws javax.mail.internet.AddressException
AddressException
is thrown.email
- the email address to validate.javax.mail.internet.AddressException
- thrown on validation error.public static void validateICTPlatform(String email) throws javax.mail.internet.AddressException
AddressException
is thrown.
CAUTION: Do not use this validation function as a standalone validation!
It must always validate addresses that have already passed through some
standard validator like an RFC one.
It invalidates the extra following types of addresses: Local domains not allowed, e.g. user@localhost, user@localdomain, user@somehost.localdomain IP addresses not allowed, e.g. user@127.0.0.1, user@10.0.1.1, user@8.8.8.8, user@147.102.5.97, user@192.168.1.245 Number of characters in top level domain must not less than 2 or more than 6, e.g. username@yahoo.c, username@yahoo.corporate
email
- the email address to validate.javax.mail.internet.AddressException
- thrown on validation error.Copyright © 2020. All rights reserved.