ComponentPro UltimateEmailValidator

      Using Wildcard Masks to filter black or white email addresses

      Language Filter: AllSend comments on this topic to ComponentPro

      By using Wildcard mask you can quickly and easily verify bad emails and good emails according to you defined BlackList and WhiteList. To do that, you need to specify the lowest ValidationLevel.

      The example below shows how to verify bad and good emails.

      using System;
      using ComponentPro.Net;
      
      ...
      
      static void Main()
      {
          string email = "test@adomain.com";
          string emails = "vietnt@hanoictt.com;jimmy@adomain.com";
          // Create a new instance of the EmailValidator class. 
          EmailValidator em = new EmailValidator();
          em.ValidationLevel = ValidationLevel.Lists;
          em.EmailValidated += em_EmailValidated;
      
          // You can use wilcards to validate email addresses 
          em.BlackList.Add("te??@*.com");
          em.BlackList.Add("*@adomain.com");
          em.WhiteList.Add("*@hanoictt.com");
      
          // Validate an email 
          em.Validate(email);
      
          // Validate a list of emails 
          em.ValidateEmails(emails);
      }
      
      static void em_EmailValidated(object sender, EmailValidatedEventArgs e)
      {
          // Show result for each validated e-mail address. 
          Console.WriteLine(e.ValidatedLevel == ValidationLevel.Success ? (e.EmailAddress + " is a valid email") : (e.EmailAddress + " is an invalid email"));
      }