EmailVerify.NET - Verify multiple addresses at once code in C#
The following example verifies a set of e-mail addresses all at the once, using EmailVerify.NET batch verification engine.
Upon finishing, the verification results are written to the console window.
var verifier = new EmailBatchVerifier();
// Set up some addresses to check
var addresses = new List<VerificationData>();
addresses.Add(new VerificationData("me@example.com", VerificationLevel.Disposable));
addresses.Add(new VerificationData("you@example.com", VerificationLevel.CatchAll));
// Start the batch processing asynchronously
IAsyncResult verificationResult = verifier.BeginBatchVerify(addresses);
// Use the standard thread pool to wait for the batch completion in parallel
ThreadPool.QueueUserWorkItem(delegate(object target)
{
verifier.EndBatchVerify(verificationResult);
// At this point the whole batch is completed
foreach (var address in addresses)
{
Console.WriteLine("Address: {0} -> {1}",
address.EmailAddress,
address.Status);
}
});