To validate email I am using following method i.e. official java email package
public static boolean isValidEmailAddress(String email) {
boolean result = true;
try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();
} catch (AddressException ex) {
result = false;
}
return result;
}
But above method also considers true for even "user@localhost.com", "user@10.9.8.7? I will be grateful if someone please help me out in removing above all these while validating email id of a user? I searched in google but could not find any solution. Many thanks in advance