public final class ERXEmailValidator extends Object implements Serializable
Constructor and Description |
---|
ERXEmailValidator(boolean allowQuotedIdentifiers,
boolean allowDomainLiterals) |
Modifier and Type | Method and Description |
---|---|
static String |
hostNameForEmailString(String email)
Parses the host name from the email string
|
static Boolean |
isValidDomainString(String hostName,
long timeout)
Deprecated.
this method will throw mysterious NullPointerExceptions if used
in a loop. Evidently, something about the DirContext is not as thread safe
as the javadocs claim. Do not use it.
|
boolean |
isValidEmailAddress(String email,
long timeout,
boolean def)
Deprecated.
Deprecated because it relies on
isValidDomainString(String, long) |
boolean |
isValidEmailString(String email)
Utility method that checks to see if the specified string is a valid
email address according to the * RFC 2822 specification.
|
public ERXEmailValidator(boolean allowQuotedIdentifiers, boolean allowDomainLiterals)
allowQuotedIdentifiers
- if true, quoted identifiers are allowed (using quotes and
angle brackets around the raw address) are allowed, e.g.:
"John Smith" <john.smith@somewhere.com> The RFC says
this is a valid mailbox. If you don't want to allow this,
because for example, you only want users to enter in a raw
address (john.smith@somewhere.com - no quotes or angle
brackets), then set this to false.allowDomainLiterals
- if true, domain literals are allowed in the email address,
e.g.: someone@[192.168.1.100] or john.doe@[23:33:A2:22:16:1F]
or me@[my computer] The RFC says these are valid email
addresses, but most people don't like allowing them. If you
don't want to allow them, and only want to allow valid domain
names (RFC 1035, x.y.z.com, etc), set this to false.public boolean isValidEmailString(String email)
email
- the email address string to test for validity.public static Boolean isValidDomainString(String hostName, long timeout)
hostName
- the email hostNametimeout
- the timeout in millisecondsNamingException
public boolean isValidEmailAddress(String email, long timeout, boolean def)
isValidDomainString(String, long)
email
- the email string to testtimeout
- the timeout in millisecondsdef
- default value if timeout occursCopyright © 2002 – 2020 Project Wonder.