|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.plexobject.mail.EmailValidater
| Field Summary | |
static int |
VERIFY_EMAIL
Verify using SMTP's VRFY, EXPN or RCPT TO |
static int |
VERIFY_SYNTAX
Check syntax of email |
| Constructor Summary | |
EmailValidater(java.io.File white,
java.io.File black)
|
|
EmailValidater(java.io.InputStream white,
java.io.InputStream black)
|
|
EmailValidater(java.io.Reader white,
java.io.Reader black)
|
|
| Method Summary | |
void |
addTrustedDomain(java.lang.String domain)
it adds regular expression that matches regular expression for all emails at specified domain to white list |
void |
addTrustedEmail(java.lang.String email)
addTrustedEmail - adds email to white list |
void |
blockDomain(java.lang.String domain)
it adds regular expression that matches regular expression all emails at specified domain to black list |
void |
blockEmail(java.lang.String email)
blockEmail - adds email to black list |
java.util.ArrayList |
getBlackList()
|
int |
getCheckLevel(int level)
getCheckLevel returns level for validating emails |
static java.lang.String[] |
getListSubscribers(java.lang.String address)
returns list of subscribers for given mailing list if his/her email server supports EXPN command of SMTP |
static java.lang.String |
getUserName(java.lang.String address)
returns user-name from given email address if his/her email server supports VRFY command of SMTP |
java.util.ArrayList |
getWhiteList()
|
boolean |
isBlackListed(java.lang.String email)
isBlackListed - checks email address in black list. |
boolean |
isWhiteListed(java.lang.String email)
isWhiteListed - checks email address in white list. |
static void |
main(java.lang.String[] args)
|
void |
removeBlockDomain(java.lang.String domain)
it removes regular expression that matches regular expression all emails at specified domain from black list |
void |
removeBlockEmail(java.lang.String email)
removeBlockEmail - remove email from black list |
void |
removeTrustedDomain(java.lang.String domain)
it removes regular expression that matches regular expression all emails at specified domain from white list |
void |
removeTrustedEmail(java.lang.String email)
removeTrustedEmail - remove email from white list |
void |
saveBlackList(java.io.File file)
saveBlackList -saves list of trusted emails to a file |
void |
saveWhiteList(java.io.File file)
saveWhiteList -saves list of trusted emails to a file |
void |
setCheckLevel(int level)
setCheckLevel sets level for validating emails |
void |
validate(java.lang.String email)
validate - verifies email based on check level previously set by the user |
void |
validate(java.lang.String email,
boolean updateBlackList)
validate - verifies email based on check level previously set by the user |
void |
validate(java.lang.String email,
int check,
boolean updateBlackList)
validate - verifies email based on check level specified |
static void |
validateSyntax(java.lang.String address)
validateSyntax - checks email's syntax |
void |
verifyEmail(java.lang.String email,
boolean updateBlackList)
verifyEmail - connects to the mail server and verifies email address |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int VERIFY_SYNTAX
public static final int VERIFY_EMAIL
| Constructor Detail |
public EmailValidater(java.io.File white,
java.io.File black)
throws java.io.IOException
white - specifies file that stores list of trusted email
addresses or regular expressions. If email address matches whitelist,
it is trusted as validated and is not verified against mail server
of the domain.black - specifies file that stores list of untrusted email
addresses or regular expressions. If email address matches blacklist,
it is rejected without verifying against mail server of the domain.
Note: Both white and black list files specify an email address or
regular expression one per line. You can contain comments if the line
begins with #, e.g.
### White List
.*@myhost.com
...
### Black List
userxxx@somehost.com
.*@hotmail.com
...
public EmailValidater(java.io.InputStream white,
java.io.InputStream black)
throws java.io.IOException
white - specifies file that stores list of trusted email
addresses or regular expressions. If email address matches whitelist,
it is trusted as validated and is not verified against mail server
of the domain.black - specifies file that stores list of untrusted email
addresses or regular expressions. If email address matches blacklist,
it is rejected without verifying against mail server of the domain.
Note: Both white and black list files specify an email address or
regular expression one per line. You can contain comments if the line
begins with #, e.g.
### White List
.*@myhost.com
...
### Black List
userxxx@somehost.com
.*@hotmail.com
...
public EmailValidater(java.io.Reader white,
java.io.Reader black)
throws java.io.IOException
white - specifies file that stores list of trusted email
addresses or regular expressions. If email address matches whitelist,
it is trusted as validated and is not verified against mail server
of the domain.black - specifies file that stores list of untrusted email
addresses or regular expressions. If email address matches blacklist,
it is rejected without verifying against mail server of the domain.
Note: Both white and black list files specify an email address or
regular expression one per line. You can contain comments if the line
begins with #, e.g.
### White List
.*@myhost.com
...
### Black List
userxxx@somehost.com
.*@hotmail.com
...| Method Detail |
public void setCheckLevel(int level)
level - - indicates new checking level for email verificationpublic int getCheckLevel(int level)
public void validate(java.lang.String email)
throws IllegalEmailException
email - - email address to verify
IllegalEmailException - upon verification failure
public void validate(java.lang.String email,
boolean updateBlackList)
throws IllegalEmailException
email - - email address to verifyupdateBlackList - - updates black list if email address is invalid.
However, it will not updae blacklist if there is an I/O error
while communicating with the mail server.
IllegalEmailException - upon verification failure
public void validate(java.lang.String email,
int check,
boolean updateBlackList)
throws IllegalEmailException
email - - email address to verifyupdateBlackList - - updates black list if email address cannot be
verified. However, it will not updae blacklist if there is a
syntax error or if there is an I/O error while communicating
with the mail server.
IllegalEmailException - upon verification failure
public static void validateSyntax(java.lang.String address)
throws IllegalEmailException
IllegalEmailException - if syntax is incorrect.
public void verifyEmail(java.lang.String email,
boolean updateBlackList)
throws IllegalEmailException
email - - email address to check
IllegalEmailException - if mail server cannot be connected or
email address does not exist.public boolean isWhiteListed(java.lang.String email)
email - address to check
public void addTrustedEmail(java.lang.String email)
email - address or regular expressionpublic void addTrustedDomain(java.lang.String domain)
domain - or regular expressionpublic void removeTrustedEmail(java.lang.String email)
email - address or regular expressionpublic void removeTrustedDomain(java.lang.String domain)
domain - or regular expressionpublic boolean isBlackListed(java.lang.String email)
email - address to check
public void blockEmail(java.lang.String email)
email - address or regular expressionpublic void blockDomain(java.lang.String domain)
domain - or regular expressionpublic void removeBlockEmail(java.lang.String email)
email - address or regular expressionpublic void removeBlockDomain(java.lang.String domain)
domain - or regular expressionpublic java.util.ArrayList getBlackList()
public java.util.ArrayList getWhiteList()
public void saveWhiteList(java.io.File file)
throws java.io.IOException
file - - output file
java.io.IOException - - is thrown if there is an I/O error
public void saveBlackList(java.io.File file)
throws java.io.IOException
file - - output file
java.io.IOException - - is thrown if there is an I/O error
public static java.lang.String getUserName(java.lang.String address)
throws IllegalEmailException
address - - email address
IllegalEmailException - if there is I/O error or SMTP server
does not support VRFY command.
public static java.lang.String[] getListSubscribers(java.lang.String address)
throws IllegalEmailException
address - - email address
IllegalEmailException - if there is I/O error or SMTP server
does not support EXPN command.public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||