Advanced email validation component for Microsoft .NET
var verifier = new EmailVerifier();
// ...
var result = verifier.Verify("bob@example.com",
VerificationLevel.Mailbox);
if (result.IsSuccess)
{
// The mailbox exists
}
else
{
switch (result.Status)
{
case VerificationStatus.LocalSenderAddressRejected:
// The foreign mail exchanger rejected our sender address
break;
case VerificationStatus.MailboxConnectionFailure:
// A network failure happened while connecting to the foreign
// mail exchanger
break;
case VerificationStatus.MailboxDoesNotExist:
// The mailbox does not exist
break;
case VerificationStatus.MailboxTemporarilyUnavailable:
// The mailbox is temporarily unavailable: we need to validate
// it again in a few minutes (greylisting)
break;
case VerificationStatus.MailboxValidationTimeout:
// A timeout occured while validating the mailbox; we need
// to increase the related settings value
break;
case VerificationStatus.ServerDoesNotSupportInternationalMailboxes:
// The local part of the address is in a non-ASCII encoding but
// the foreign mail exchanger can't handle this type of addresses
break;
// TODO: Add more cases, if needed
default:
// ...
break;
}
}