Table of Contents

Class EmailMessage

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

Represents a EmailMessage. Encapsulates a System.Net.MailMessage with functions to accept a LogEntry, Formatting, and sending of emails

public class EmailMessage
Inheritance
EmailMessage
Inherited Members

Constructors

EmailMessage(EmailTraceListenerData, LogEntry, ILogFormatter)

Initializes a EmailMessage with email configuration data, logentry, and formatter

public EmailMessage(EmailTraceListenerData configurationData, LogEntry logEntry, ILogFormatter formatter)

Parameters

configurationData EmailTraceListenerData

The configuration data EmailTraceListenerData that represents how to create the email message

logEntry LogEntry

The LogEntry LogEntry to send via email.

formatter ILogFormatter

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

EmailMessage(string, string, string, string, string, int, LogEntry, ILogFormatter)

Initializes a EmailMessage with the raw data to create and email, the logentry, and the formatter

public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, LogEntry logEntry, 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.

logEntry LogEntry

The LogEntry LogEntry to send via email.

formatter ILogFormatter

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

EmailMessage(string, string, string, string, string, int, LogEntry, ILogFormatter, EmailAuthenticationMode, string, string, bool)

Initializes a EmailMessage with the raw data to create and email, the logentry, and the formatter

public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, LogEntry logEntry, 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.

logEntry LogEntry

The LogEntry LogEntry to send via email.

formatter ILogFormatter

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

authenticationMode EmailAuthenticationMode

Authenticate mode to use when connecting to SMTP server.

userName string

User name to send to SMTP server if using username/password authentication.

password string

Password to send to SMTP server if using username/password authentication.

useSSL bool

Use SSL to connect to STMP server - if true, yes, if false, no.

EmailMessage(string, string, string, string, string, int, string, ILogFormatter)

Initializes a EmailMessage with the raw data to create and email, a message, and the formatter

public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, string message, 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.

message string

Represents the message to send via email.

formatter ILogFormatter

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

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

Initializes a EmailMessage with the raw data to create and email, a message, and the formatter

public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, string message, 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.

message string

Represents the message to send via email.

formatter ILogFormatter

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

authenticationMode EmailAuthenticationMode

Authenticate mode to use when connecting to SMTP server.

userName string

User name to send to SMTP server if using username/password authentication.

password string

Password to send to SMTP server if using username/password authentication.

useSSL bool

Use SSL to connect to STMP server - if true, yes, if false, no.

Methods

CreateMailMessage()

Creates a MailMessage from the configuration data which was used to create the instance of this object.

protected MailMessage CreateMailMessage()

Returns

MailMessage

A new MailMessage.

Send()

Uses the settings for the SMTP server and SMTP port to send the new mail message

public virtual void Send()

SendMessage(MailMessage)

Uses the settings for the SMTP server and SMTP port to send the MailMessage that it is passed

public virtual void SendMessage(MailMessage message)

Parameters

message MailMessage

MailMessage to send via SMTP