/** * Verify that the given string is a valid email address. * "Validity" in this context only means that the address conforms * to the correct syntax (not if the address actually exists). * * @param email The email address to verify. * @return a boolean indicating whether the email address is correctly formatted. */ public final static boolean verifyEmail(String email) { return MailUtils.verifyEmail(email); }
/** * Verify that the given string is a valid email address. * "Validity" in this context only means that the address conforms * to the correct syntax (not if the address actually exists). * * @param email The email address to verify. * @return a boolean indicating whether the email address is correctly formatted. */ public final static boolean verifyEmail(String email) { return MailUtils.verifyEmail(email); }
public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); String value = (String) getFieldValue(fieldName, object); if (value == null) { return; } value = value.trim(); if (value.length() == 0) { return; } String[] emails = value.split("\\s*,\\s*"); // split on comma surrounded by option whitespace // now validate each e-mail address for (int i=0; i < emails.length; i++) { if (!MailUtils.verifyEmail(emails[i])) { addFieldError(fieldName, object); break; } } } }