ComponentPro UltimateEmailValidator

      Validating a single e-mail address Synchronously

      Language Filter: AllSend comments on this topic to ComponentPro

      The easiest way to Validate a single email address is using Validate method. You need to pass the email address you want to validate to this method and result value will show you what validation level the provided email address has passed.

      UltimateEmailValidator verifies emails at five different levels. These levels include:

      Syntax Validates email address syntax defined by EmailSyntaxPattern.
      Lists Verifies up to the black and white list check. The black list is checked first.
      If an email-address exists in both black list and white list, the email is treated as a valid email.
      MailExchangeRecords Verifies up to the Mail Exchange record check, does a DNS request for a domain's mail exchange records. Certain mail servers may not have MX records but still be valid.  All checks above this level will still be attempted even if the MX record check fails.
      SmtpConnection Verifies up to the SMTP connection check, checks to see if a domains mail exchange can be connected to.
      If no mail exchange is found it will attempt to connect to the A record for the domain specified in the address.
      Mailbox Verifies up to an SMTP send attempt.  Once the server accepts or rejects the email address the send is cancelled and no message is actually sent.

      The following steps will help you to validate a single e-mail address:

      Validating a single e-mail address

      1. Add using directives to your code to create aliases for existing namespaces and avoid having to type the fully qualified type names. The code looks similar to the following:
        using System;
        using ComponentPro.Net;
        
      2. Create a new instance of the EmailValidator class.
        // Create a new instance of the EmailValidator class.
        EmailValidator validator = new EmailValidator();
        
      3. Now pass the e-mail address you want to validate to the Validate method. The code looks similar to the following:
        // Validate the email.
        ValidationLevel result = validator.Validate("contact@componentpro.com");
        

      Final example code

      using System;
      using ComponentPro.Net;
      
      ...
      
      // Create a new instance of the EmailValidator class.
      EmailValidator validator = new EmailValidator();
      
      // Validate the email.
      ValidationLevel result = validator.Validate("contact@componentpro.com");
      
      // Show result.
      Console.WriteLine(string.Format("Email address '{0}' has been validated at level {1}", "contact@componentpro.com", result.ToString()));