Hi,
I have used the “EmailValidator” class to validate the Email ID. While using this class, I found that it is not returning me the correct result.
When i give the Email ID ending with .com or co.in it is showing it as valid but we are having our internal domain for e.g. "abc.local " and email id as “pqr@abc.local” but the class identifying it as “Invalid Email”. When we try to send the email to those address for this domain from Outlook desktop clients, they got send successfully.
I have used the below mentioned code:
e.g
EmailValidator emailValidate = new EmailValidator();
ValidationResult result;
emailValidate.Validate(emailID,ValidationPolicy.SyntaxAndDomain,out result);
if(result.ReturnCode == ValidationResponseCode.ValidationSuccess)
return SuccessPath;
else
return FailedPath;
For the above code, it is returning as “Failed Path”.
If in case, I remove the second parameter from Validate method as:
** emailValidate.Validate(emailID,out result);**
Still it showed me the address as “Invalid”.
Now if I change the second parameter of Validate method to check for Syntax only as shown below:
“emailValidate.Validate(emailID,ValidationPolicy.SyntaxOnly ,out result);”
Now for the above code, it is showing the email address ( ‘pqr@abc.local’ ) as Valid but when I tried to pass in-valid address ( ‘pqr@abc_local’), it returned me this as Valid but in actual it is not a valid address.
Kindly suggest me which API should i use for validation of email along with the appropriate parameters?
Thanks.