NET Email Validation
ClearLog(MemoryStream) Method
Example 






KellermanSoftware.NetEmailValidation Namespace > EmailValidation Class > ClearLog Method : ClearLog(MemoryStream) Method
Clear the memory stream log
Syntax
'Declaration
 
Public Overloads Function ClearLog( _
   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.ClearLog(memStream)
public System.bool ClearLog( 
   ref System.IO.MemoryStream memStream
)
public function ClearLog( 
   var  memStream: System.IO.MemoryStream
): System.Boolean; 
public function ClearLog( 
   memStream : System.IO.MemoryStream
) : System.boolean;
public: System.bool ClearLog( 
   ref System.IO.MemoryStream* memStream
) 
public:
System.bool ClearLog( 
   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);
 
//Clear the memory stream
emailValidator.ClearLog(ref memStream);
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)
 
'Clear the memory stream
emailValidator.ClearLog(memStream)
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