NET Email Validation
ValidEmail(String,String,List<ValidationOptions>) Method
Example 






KellermanSoftware.NetEmailValidation Namespace > EmailValidation Class > ValidEmail Method : ValidEmail(String,String,List<ValidationOptions>) Method
Validate an email address synchronously using the passed in options
Syntax
'Declaration
 
Public Overloads Function ValidEmail( _
   ByVal contactId As System.String, _
   ByVal emailAddress As System.String, _
   ByVal options As System.Collections.Generic.List(Of ValidationOptions) _
) As Result
'Usage
 
Dim instance As EmailValidation
Dim contactId As System.String
Dim emailAddress As System.String
Dim options As System.Collections.Generic.List(Of ValidationOptions)
Dim value As Result
 
value = instance.ValidEmail(contactId, emailAddress, options)
public Result ValidEmail( 
   System.string contactId,
   System.string emailAddress,
   System.Collections.Generic.List<ValidationOptions> options
)
public function ValidEmail( 
    contactId: System.String;
    emailAddress: System.String;
    options: System.Collections.Generic.List
): Result; 
public function ValidEmail( 
   contactId : System.String,
   emailAddress : System.String,
   options : System.Collections.Generic.List
) : Result;
public: Result* ValidEmail( 
   System.string* contactId,
   System.string* emailAddress,
   System.Collections.Generic.List<ValidationOptions>* options
) 
public:
Result^ ValidEmail( 
   System.String^ contactId,
   System.String^ emailAddress,
   System.Collections.Generic.List<ValidationOptions>^ options
) 

Parameters

contactId
emailAddress
options
Example
EmailValidation emailValidator = new EmailValidation(); //Trial Mode
//EmailValidation emailValidator = new EmailValidation("place user name here", "place license key here"); //License Mode
 
emailValidator.FromEmail = "someone@somewhere.com";
emailValidator.FromMailServer = "mail.somewhere.com";
 
List<ValidationOptions> options = emailValidator.BestConnectionOptions();
 
Result myResult = emailValidator.ValidEmail("1", "johnsmith@hotmail.com", options);
 
//Print the results to the console
Console.WriteLine(myResult.UserMessage);
Console.WriteLine();
Console.WriteLine(myResult.StatusDescription);
Console.WriteLine();
Console.WriteLine(myResult.Log);
Dim emailValidator As EmailValidation = New EmailValidation() 'Trial Mode
'Dim emailValidator As EmailValidation = New EmailValidation("place user name here", "place license key here") 'License Mode
 
emailValidator.FromEmail = "someone@somewhere.com"
emailValidator.FromMailServer = "mail.somewhere.com"
 
Dim options As List(Of ValidationOptions) = emailValidator.BestConnectionOptions()
 
Dim myResult As Result = emailValidator.ValidEmail("1", "johnsmith@hotmail.com", options)
 
'Print the results to the console
Console.WriteLine(myResult.UserMessage)
Console.WriteLine()
Console.WriteLine(myResult.StatusDescription)
Console.WriteLine()
Console.WriteLine(myResult.Log)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EmailValidation Class
EmailValidation Members
Overload List