When the email list to validate is long and your application may take time to validate all e-mails, you may wish to show the progress of the validation to the user. The UltimateEmailValidator component provides progress notification through the Progress event. The Progress event is raised periodically while e-mail validation is in progress, making accessible necessary data to display progress information, such as e-mail address and validation level.
The following steps show you how to use the Progress event to show progress information while validating e-mail addresses:
using System; using ComponentPro.Net;
EmailValidator em = new EmailValidator();
// Register an event handler. em.Progress += em_Progress; try { em.ValidateTextFile("c:\\EmailList.txt"); } catch (EmailValidatorException exc2) { Console.WriteLine("EmailValidatorException: " + exc2.Message); }
using System; using ComponentPro.Net; ... static void Main() { EmailValidator em = new EmailValidator(); // Register an event handler. em.Progress += em_Progress; try { em.ValidateTextFile("c:\\EmailList.txt"); } catch (EmailValidatorException exc2) { Console.WriteLine("EmailValidatorException: " + exc2.Message); } } static void em_Progress(object sender, EmailValidatorProgressEventArgs e) { Console.WriteLine("Validating email '{0}' at level {1}. Completed {2}%", e.EmailAddress, e.Level.ToString(), e.ProgressPercentage); }