Hi there
I am using Aspose.Email 1.6.0.0. I am trying to validate my GMail and Hotmail address. But its always giving failure. Is there any change in the new versions as this feature was working earlier?
Sample file is attached.
Best Regards
Sajjad
Hi there
Hi Sajjad,
Hi Sajjad,
So what does Aspose returns in such cases: Valid? Invalid? or could not check?
Hi Luis,
Thank you for writing to us.
Please give a try to the following sample code by setting invalid and valid email addresses. Depending upon the server settings, some of them may validate it and others may not. If we use some Gmail account, it is detecting valid and invalid email addresses.
string emailToTest = "user@gmail.com";
EmailValidator ev = new EmailValidator();
ValidationResult result = new ValidationResult();
ev.Validate(emailToTest, ValidationPolicy.MailServer, out result);
if (result.ReturnCode == ValidationResponseCode.ValidationSuccess)
Console.WriteLine("Email is valid");
else
Console.WriteLine("Invalid email");
ev.Validate(emailToTest, ValidationPolicy.SyntaxAndDomain, out result);
if (result.ReturnCode == ValidationResponseCode.ValidationSuccess)
Console.WriteLine("SyntaxAndDomain passed");
else
Console.WriteLine("SyntaxAndDomain failed");
ev.Validate(emailToTest, ValidationPolicy.SyntaxOnly, out result);
if (result.ReturnCode == ValidationResponseCode.ValidationSuccess)
Console.WriteLine("SyntaxOnly passed");
else
Console.WriteLine("SyntaxOnly failed");