Validating email addresses |
The EmailInspector class may be used to validate email addresses. Several levels of email validation are provided, everything from basic syntax validation to more thorough user validation.
Example
EmailInspector insp = new EmailInspector(); //set the DNS server to be used for domain resolution insp.setNameserver("ns.domain.com"); insp.setDebug(true);
// set the level of validation insp.setEmailInspectionLevel(EmailInspector.USER_VALIDATION);
// perform validation of email address try { insp.validate("user@domain.com"); } catch (Exception e) { e.printStackTrace(System.out); // validation failed }
Validation levels
|