Hello guys recently I was blocked in email verification and I was not interested to do with the regular expression because in some cases it was failed to validate. I found some classes to validate emails easily. Please refer the code

Step 1:- import

import org.apache.commons.validator.routines.EmailValidator

Step 2:-
If you have data in the param then

Boolean isValid
List<String> emailList = param.emailList.split(",")
EmailValidator emailValidator = EmailValidator.getInstance()
for (int i = 0; i < emailTarget.size(); i++) {
isValid = emailValidator.isValid(emailTarget[i])
if (!validation) {
break
}
}

or

EmailValidator emailValidator = EmailValidator.getInstance()
StringTokenizer st=new  StringTokenizer(param.emailList,”,”)
while(st.hasMoreToken()) {
isValid = emailValidator.isValid(st.nextToken());
if (!isValid) {
break
}
}

Step 3:-

if(isValid) {
//Do your operation...
}