Class EmailMessage
- 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
EmailTraceListenerDataThe configuration data EmailTraceListenerData that represents how to create the email message
logEntry
LogEntryThe LogEntry LogEntry to send via email.
formatter
ILogFormatterThe 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
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.
logEntry
LogEntryThe LogEntry LogEntry to send via email.
formatter
ILogFormatterThe 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
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.
logEntry
LogEntryThe LogEntry LogEntry to send via email.
formatter
ILogFormatterThe Formatter ILogFormatter which determines how the email message should be formatted
authenticationMode
EmailAuthenticationModeAuthenticate mode to use when connecting to SMTP server.
userName
stringUser name to send to SMTP server if using username/password authentication.
password
stringPassword to send to SMTP server if using username/password authentication.
useSSL
boolUse 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
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.
message
stringRepresents the message to send via email.
formatter
ILogFormatterThe 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
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.
message
stringRepresents the message to send via email.
formatter
ILogFormatterThe Formatter ILogFormatter which determines how the email message should be formatted
authenticationMode
EmailAuthenticationModeAuthenticate mode to use when connecting to SMTP server.
userName
stringUser name to send to SMTP server if using username/password authentication.
password
stringPassword to send to SMTP server if using username/password authentication.
useSSL
boolUse 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
MailMessageMailMessage to send via SMTP