NET Email Validation
EnableLogging(MemoryStream) Method
Example 






KellermanSoftware.NetEmailValidation Namespace > EmailValidation Class > EnableLogging Method : EnableLogging(MemoryStream) Method
Log to a memory stream
Syntax
'Declaration
 
Public Overloads Function EnableLogging( _
   ByRef memStream As System.IO.MemoryStream _
) As System.Boolean
'Usage
 
Dim instance As EmailValidation
Dim memStream As System.IO.MemoryStream
Dim value As System.Boolean
 
value = instance.EnableLogging(memStream)
public System.bool EnableLogging( 
   ref System.IO.MemoryStream memStream
)
public function EnableLogging( 
   var  memStream: System.IO.MemoryStream
): System.Boolean; 
public function EnableLogging( 
   memStream : System.IO.MemoryStream
) : System.boolean;
public: System.bool EnableLogging( 
   ref System.IO.MemoryStream* memStream
) 
public:
System.bool EnableLogging( 
   System.IO.MemoryStream^% memStream
) 

Parameters

memStream
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";
 
//Set up a memory stream for logging
System.IO.MemoryStream memStream = new System.IO.MemoryStream();
emailValidator.EnableLogging(ref memStream);
 
//Connect using the best available options
List<ValidationOptions> options = emailValidator.BestConnectionOptions();
Console.WriteLine(emailValidator.BestConnectionMessage);
 
//Validate a single email with the best available options
Result myResult = emailValidator.ValidEmail("john.smith@hotmail.com", options);
 
//Print the results to the console
memStream.Seek(0, 0);
 
string logText;
 
using (StreamReader reader = new StreamReader(memStream))
{
   logText= reader.ReadToEnd();
}
 
Console.WriteLine(logText);
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"
 
'Set up a memory stream for logging
Dim memStream As System.IO.MemoryStream = New System.IO.MemoryStream()
emailValidator.EnableLogging(memStream)
 
'Connect using the best available options
Dim options As List(Of ValidationOptions) = emailValidator.BestConnectionOptions()
Console.WriteLine(emailValidator.BestConnectionMessage)
 
'Validate a single email with the best available options
Dim myResult As Result = emailValidator.ValidEmail("john.smith@hotmail.com", options)
 
'Print the results to the console
memStream.Seek(0, 0)
 
Dim logText As String
 
Using reader As StreamReader = New StreamReader(memStream)
   logText= reader.ReadToEnd()
End Using
 
Console.WriteLine(logText)
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