NET Logging Library
EmailLogFile(EmailParameters) Method
Example 



KellermanSoftware.NetLoggingLibrary Namespace > ConcreteLog Class > EmailLogFile Method : EmailLogFile(EmailParameters) Method
Email all log files for all active targets that inherit from BaseFileTarget
Syntax
Public Overloads Sub EmailLogFile( _
   ByVal parameters As EmailParameters _
) 
Dim instance As ConcreteLog
Dim parameters As EmailParameters
 
instance.EmailLogFile(parameters)
public void EmailLogFile( 
   EmailParameters parameters
)
public:
void EmailLogFile( 
   EmailParameters^ parameters
) 

Parameters

parameters
Example
ConcreteLog logger = new ConcreteLog();
 
//Clear all configuration
logger.ResetConfiguration();
 
//Add a new target, you can also define targets in an xml file, app.config, or web.config
FileTarget fileTarget = new FileTarget(Environment.CurrentDirectory + "\\fileLogger.txt");
logger.Config.Targets.Add(fileTarget);
 
//Parameters
EmailParameters parameters = new EmailParameters();
parameters.SmtpServer = "mail.example.com";
parameters.SmtpPort = 587;
parameters.FromEmail = "testemail@example.com";
parameters.ToEmail = "testemail2@example.com";
parameters.Bcc = "";
parameters.Subject = "Logging message";
parameters.IsBodyHtml = true;
parameters.UserName = "testemail@example.com";
parameters.Password = "secret";
 
logger.Debug("Test Message");
 
logger.EmailLogFile(parameters);
Dim logger As New ConcreteLog()
 
'Clear all configuration
logger.ResetConfiguration()
 
'Add a new target, you can also define targets in an xml file, app.config, or web.config
Dim fileTarget As New FileTarget(Environment.CurrentDirectory & "\fileLogger.txt")
logger.Config.Targets.Add(fileTarget)
 
'Parameters
Dim parameters As New EmailParameters()
parameters.SmtpServer = "mail.example.com"
parameters.SmtpPort = 587
parameters.FromEmail = "testemail@example.com"
parameters.ToEmail = "testemail2@example.com"
parameters.Bcc = ""
parameters.Subject = "Logging message"
parameters.IsBodyHtml = True
parameters.UserName = "testemail@example.com"
parameters.Password = "secret"
 
logger.Debug("Test Message")
 
logger.EmailLogFile(parameters)
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

ConcreteLog Class
ConcreteLog Members
Overload List