C# Class GSF.Net.Smtp.Mail

A wrapper class to the MailMessage class that simplifies sending mail messages.
Inheritance: IDisposable
Mostrar archivo Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Releases all the resources used by the Mail object.

Mail ( ) : System

Initializes a new instance of the Mail class.

Mail ( string from ) : System

Initializes a new instance of the Mail class.

Mail ( string from, string toRecipients ) : System

Initializes a new instance of the Mail class.

Mail ( string from, string toRecipients, string smtpServer ) : System

Initializes a new instance of the Mail class.

Send ( ) : void

Send the Mail message with Attachments to the ToRecipients, CcRecipients and BccRecipients using the specified SmtpServer.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer ) : void

Sends a Mail message.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string attachments, string smtpServer ) : void

Sends a Mail message.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, SecureString password ) : void

Sends a secure Mail message.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, SecureString password, bool enableSSL ) : void

Sends a secure Mail message.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, string password ) : void

Sends a secure Mail message.

Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, string password, bool enableSSL ) : void

Sends a secure Mail message.

Send ( string from, string toRecipients, string ccRecipients, string bccRecipients, string subject, string body, bool isBodyHtml, string smtpServer ) : void

Sends a Mail message.

Send ( string from, string toRecipients, string ccRecipients, string bccRecipients, string subject, string body, bool isBodyHtml, string attachments, string smtpServer ) : void

Sends a Mail message.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the Mail object and optionally releases the managed resources.

Private Methods

Method Description
ApplySecuritySettings ( ) : void

Method Details

Dispose() public method

Releases all the resources used by the Mail object.
public Dispose ( ) : void
return void

Dispose() protected method

Releases the unmanaged resources used by the Mail object and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

Mail() public method

Initializes a new instance of the Mail class.
public Mail ( ) : System
return System

Mail() public method

Initializes a new instance of the Mail class.
public Mail ( string from ) : System
from string The e-mail address of the message sender.
return System

Mail() public method

Initializes a new instance of the Mail class.
public Mail ( string from, string toRecipients ) : System
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
return System

Mail() public method

Initializes a new instance of the Mail class.
public Mail ( string from, string toRecipients, string smtpServer ) : System
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
return System

Send() public method

Send the Mail message with Attachments to the ToRecipients, CcRecipients and BccRecipients using the specified SmtpServer.
public Send ( ) : void
return void

Send() public static method

Sends a Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
return void

Send() public static method

Sends a Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string attachments, string smtpServer ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
attachments string A comma-separated or semicolon-separated list of file names to be attached to the message.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
return void

Send() public static method

Sends a secure Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, SecureString password ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
username string The username of the account used to authenticate to the SMTP server.
password System.Security.SecureString The password of the account used to authenticate to the SMTP server.
return void

Send() public static method

Sends a secure Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, SecureString password, bool enableSSL ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
username string The username of the account used to authenticate to the SMTP server.
password System.Security.SecureString The password of the account used to authenticate to the SMTP server.
enableSSL bool The flag that determines whether to use SSL when communicating with the SMTP server.
return void

Send() public static method

Sends a secure Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, string password ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
username string The username of the account used to authenticate to the SMTP server.
password string The password of the account used to authenticate to the SMTP server.
return void

Send() public static method

Sends a secure Mail message.
public static Send ( string from, string toRecipients, string subject, string body, bool isBodyHtml, string smtpServer, string username, string password, bool enableSSL ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
username string The username of the account used to authenticate to the SMTP server.
password string The password of the account used to authenticate to the SMTP server.
enableSSL bool The flag that determines whether to use SSL when communicating with the SMTP server.
return void

Send() public static method

Sends a Mail message.
public static Send ( string from, string toRecipients, string ccRecipients, string bccRecipients, string subject, string body, bool isBodyHtml, string smtpServer ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
ccRecipients string A comma-separated or semicolon-separated e-mail address list of the message carbon copy (CC) recipients.
bccRecipients string A comma-separated or semicolon-separated e-mail address list of the message blank carbon copy (BCC) recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
return void

Send() public static method

Sends a Mail message.
public static Send ( string from, string toRecipients, string ccRecipients, string bccRecipients, string subject, string body, bool isBodyHtml, string attachments, string smtpServer ) : void
from string The e-mail address of the message sender.
toRecipients string A comma-separated or semicolon-separated e-mail address list of the message recipients.
ccRecipients string A comma-separated or semicolon-separated e-mail address list of the message carbon copy (CC) recipients.
bccRecipients string A comma-separated or semicolon-separated e-mail address list of the message blank carbon copy (BCC) recipients.
subject string The subject of the message.
body string The body of the message.
isBodyHtml bool true if the message body is to be formated as HTML; otherwise false.
attachments string A comma-separated or semicolon-separated list of file names to be attached to the message.
smtpServer string The name or IP address of the SMTP server to be used for sending the message.
return void