Table of Contents

Class EmailTraceListener

Namespace
Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners
Assembly
Microsoft.Practices.EnterpriseLibrary.Logging.dll

A TraceListener that writes an email message, formatting the output with an ILogFormatter.

public class EmailTraceListener : FormattedTraceListenerBase, IDisposable
Inheritance
EmailTraceListener
Implements
Inherited Members

Constructors

EmailTraceListener(string, string, string, string, string)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, smtpport, and a formatter a ILogFormatter.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

EmailTraceListener(string, string, string, string, string, ILogFormatter)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, and a formatter a ILogFormatter.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, ILogFormatter formatter)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

formatter ILogFormatter

The Formatter ILogFormatter which determines how the email message should be formatted

EmailTraceListener(string, string, string, string, string, int)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, smtpport.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

smtpPort int

The port on the SMTP server to use for sending the email.

EmailTraceListener(string, string, string, string, string, int, ILogFormatter)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, smtpport, and a formatter a ILogFormatter.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

smtpPort int

The port on the SMTP server to use for sending the email.

formatter ILogFormatter

The Formatter ILogFormatter which determines how the email message should be formatted

EmailTraceListener(string, string, string, string, string, int, ILogFormatter, EmailAuthenticationMode, string, string, bool)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, smtpport, and a formatter a ILogFormatter.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

smtpPort int

The port on the SMTP server to use for sending the email.

formatter ILogFormatter

The Formatter ILogFormatter which determines how the email message should be formatted

authenticationMode EmailAuthenticationMode

Authentication style to use when connecting to SMTP server.

userName string

User name to use for authentication if using username/password authentication.

password string

Password to use for authentication if using username/password authentication.

useSSL bool

Use SSL to connect to mail server if true, regular socket if false.

EmailTraceListener(string, string, string, string, string, int, EmailAuthenticationMode, string, string, bool)

Initializes a new instance of EmailTraceListener with a toaddress, fromaddress, subjectlinestarter, subjectlinender, smtpserver, smtpport and authentication information.

public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)

Parameters

toAddress string

A semicolon delimited string the represents to whom the email should be sent.

fromAddress string

Represents from whom the email is sent.

subjectLineStarter string

Starting text for the subject line.

subjectLineEnder string

Ending text for the subject line.

smtpServer string

The name of the SMTP server.

smtpPort int

The port on the SMTP server to use for sending the email.

authenticationMode EmailAuthenticationMode

Authentication style to use when connecting to SMTP server.

userName string

User name to use for authentication if using username/password authentication.

password string

Password to use for authentication if using username/password authentication.

useSSL bool

Use SSL to connect to mail server if true, regular socket if false.

Methods

GetSupportedAttributes()

Declare the supported attributes for EmailTraceListener

protected override string[] GetSupportedAttributes()

Returns

string[]

TraceData(TraceEventCache, string, TraceEventType, int, object)

Delivers the trace data as an email message.

public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)

Parameters

eventCache TraceEventCache

The context information provided by System.Diagnostics.

source string

The name of the trace source that delivered the trace data.

eventType TraceEventType

The type of event.

id int

The id of the event.

data object

The data to trace.

Write(string)

Sends an email message given a predefined string

public override void Write(string message)

Parameters

message string

The string to write as the email message

WriteLine(string)

Sends an email message given a predefined string

public override void WriteLine(string message)

Parameters

message string

The string to write as the email message