![]() |
Mail Class |
public class Mail : IDisposable
The Mail type exposes the following members.
Name | Description | |
---|---|---|
![]() | Initializes a new instance of the Mail class. | |
![]() | Mail(String) | Initializes a new instance of the Mail class. |
![]() | Mail(String, String) | Initializes a new instance of the Mail class. |
![]() | Mail(String, String, String) | Initializes a new instance of the Mail class. |
Name | Description | |
---|---|---|
![]() | Attachments | Gets or sets the comma-separated or semicolon-separated list of file names to be attached to the Mail message. |
![]() | BccRecipients | Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message blank carbon copy (BCC) recipients. |
![]() | Body | Gets or sets the body of the Mail message. |
![]() | CcRecipients | Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message carbon copy (CC) recipients. |
![]() | Client | Gets the SmtpClient object used for sending the Mail message. |
![]() | EnableSSL | Gets or sets the flag that determines whether to use SSL when communicating with the SMTP server. |
![]() | From | Gets or sets the e-mail address of the Mail message sender. |
![]() | IsBodyHtml | Gets or sets a boolean value that indicating whether the Mail message Body is to be formatted as HTML. |
![]() | Password | Gets or sets the password used to authenticate to the SMTP server. |
![]() | SecurePassword | Gets or sets the password used to authenticate to the SMTP server. |
![]() | SmtpServer | Gets or sets the name or IP address of the SMTP server to be used for sending the Mail message. |
![]() | Subject | Gets or sets the subject of the Mail message. |
![]() | ToRecipients | Gets or sets the comma-separated or semicolon-separated e-mail address list of the Mail message recipients. |
![]() | Username | Gets or sets the username used to authenticate to the SMTP server. |
Name | Description | |
---|---|---|
![]() | Dispose | Releases all the resources used by the Mail object. |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the Mail object and optionally releases the managed resources. |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() | Finalize |
Releases the unmanaged resources before the Mail object is reclaimed by GC.
(Overrides ObjectFinalize) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) |
![]() | Send | Send the Mail message with Attachments to the ToRecipients, CcRecipients and BccRecipients using the specified SmtpServer. |
![]() ![]() | Send(String, String, String, String, Boolean, String) | Sends a Mail message. |
![]() ![]() | Send(String, String, String, String, Boolean, String, String) | Sends a Mail message. |
![]() ![]() | Send(String, String, String, String, Boolean, String, String, SecureString) | Sends a secure Mail message. |
![]() ![]() | Send(String, String, String, String, Boolean, String, String, String) | Sends a secure Mail message. |
![]() ![]() | Send(String, String, String, String, String, String, Boolean, String) | Sends a Mail message. |
![]() ![]() | Send(String, String, String, String, Boolean, String, String, SecureString, Boolean) | Sends a secure Mail message. |
![]() ![]() | Send(String, String, String, String, Boolean, String, String, String, Boolean) | Sends a secure Mail message. |
![]() ![]() | Send(String, String, String, String, String, String, Boolean, String, String) | Sends a Mail message. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
Name | Description | |
---|---|---|
![]() ![]() | DefaultSmtpServer | Default SmtpServer to be used if one is not specified. |
Name | Description | |
---|---|---|
![]() | GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
![]() | GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
using System; using GSF.Net.Smtp; class Program { static void Main(string[] args) { Mail email = new Mail("sender@email.com", "recipient@email.com", "smtp.email.com"); email.Subject = "Test Message"; email.Body = "This is a test message."; email.IsBodyHtml = true; email.Attachments = @"c:\attachment.txt"; email.Send(); email.Dispose(); Console.ReadLine(); } }