If I execute the below code with the email address (testing email address but any email with a coma will pass) "spam@home.com," the validation returns “ValidationSuccess”.
Yet, if I then set the to address to this email address that passed validation I get the run time error "An exception of type ‘System.FormatException’ occurred in System.dll but was not handled in user code. Additional information: An invalid character was found in the mail header: ‘,’."
Shouldn’t the validation fail?
Aspose.Email.Verify.EmailValidator ev = new Aspose.Email.Verify.EmailValidator();
Aspose.Email.Verify.ValidationResult result;
Aspose.Email.Verify.ValidationPolicy policy = new Aspose.Email.Verify.ValidationPolicy();
policy = Aspose.Email.Verify.ValidationPolicy.SyntaxAndDomain;
ev.Timeout = 30;
ev.DnsServers = new string[] { “x.x.x.xxx”, “x.x.x.x”};
ev.Validate(EmailAddress, policy, out result);
if (result.ReturnCode == Aspose.Email.Verify.ValidationResponseCode.ValidationSuccess)
{
validationMessage = result.ReturnCode.ToString();
return true;
}