Class EmailTraceListener
- 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe name of the SMTP server.
formatter
ILogFormatterThe 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe name of the SMTP server.
smtpPort
intThe 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe name of the SMTP server.
smtpPort
intThe port on the SMTP server to use for sending the email.
formatter
ILogFormatterThe 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe name of the SMTP server.
smtpPort
intThe port on the SMTP server to use for sending the email.
formatter
ILogFormatterThe Formatter ILogFormatter which determines how the email message should be formatted
authenticationMode
EmailAuthenticationModeAuthentication style to use when connecting to SMTP server.
userName
stringUser name to use for authentication if using username/password authentication.
password
stringPassword to use for authentication if using username/password authentication.
useSSL
boolUse 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
stringA semicolon delimited string the represents to whom the email should be sent.
fromAddress
stringRepresents from whom the email is sent.
subjectLineStarter
stringStarting text for the subject line.
subjectLineEnder
stringEnding text for the subject line.
smtpServer
stringThe name of the SMTP server.
smtpPort
intThe port on the SMTP server to use for sending the email.
authenticationMode
EmailAuthenticationModeAuthentication style to use when connecting to SMTP server.
userName
stringUser name to use for authentication if using username/password authentication.
password
stringPassword to use for authentication if using username/password authentication.
useSSL
boolUse 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
TraceEventCacheThe context information provided by System.Diagnostics.
source
stringThe name of the trace source that delivered the trace data.
eventType
TraceEventTypeThe type of event.
id
intThe id of the event.
data
objectThe data to trace.
Write(string)
Sends an email message given a predefined string
public override void Write(string message)
Parameters
message
stringThe 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
stringThe string to write as the email message