EmailVerify.NET - Inspect e-mail verification failures in C#
The following example verifies a single e-mail address up to mailbox existence and, should it find the validation
is not successful, it would inspect some of the possible failure types.
var verifier = new EmailVerifier();
var status = verifier.Verify("address@example.org", VerificationLevel.Mailbox);
if (status.IsSuccess)
{
Console.WriteLine("Mailbox verification test succeeded!");
}
else
{
// The test failed. Let's see why...
if (status.IsSyntaxFailure)
{
// The email address is not syntactically valid
// TODO: Discard this address immediately
}
else if (status.IsTimeoutFailure)
{
// It failed because of a timeout, thus it could be valid.
// TODO: Save a reference to this address for future retries
}
else if (status.IsNetworkFailure)
{
// It failed because of a network failure: chances are high that this address is not valid.
// TODO: Discard this address or save it for future retries
}
}