Namespace: System.Net.Mail
MailMessage
Represents an email message that can be sent using the SmtpClient class.
Properties (8)
MailAddress From
Gets or sets the from address for this email message.
Value: A MailAddress that contains the from address information.
MailAddressCollection To
Gets the address collection that contains the recipients of this email message.
Value: A writable MailAddressCollection object.
MailAddressCollection CC
Gets the address collection that contains the carbon copy (CC) recipients for this email message.
Value: A writable MailAddressCollection object.
MailAddressCollection Bcc
Gets the address collection that contains the blind carbon copy (BCC) recipients for this email message.
Value: A writable MailAddressCollection object.
MailAddressCollection ReplyToList
Gets the list of addresses to reply to for the mail message.
Value: The list of the addresses to reply to for the mail message.
String Subject
Gets or sets the subject line for this email message.
Value: A String that contains the subject content.
String Body
Gets or sets the message body.
Value: A String value that contains the body text.
bool IsBodyHtml
Gets or sets a value indicating whether the mail message body is in HTML.
Value: true if the message body is in HTML; else false. The default is false.
Methods (3)
MailMessage(Net.Mail.MailAddress,Net.Mail.MailAddress)Constructor
Initializes a new instance of the MailMessage class by using the specified MailAddress class objects.
| Parameter | Description |
|---|---|
| from | A MailAddress that contains the address of the sender of the email message. |
| to | A MailAddress that contains the address of the recipient of the email message. |
MailMessage(String,String)Constructor
Initializes a new instance of the MailMessage class by using the specified String class objects.
| Parameter | Description |
|---|---|
| from | A String that contains the address of the sender of the email message. |
| to | A String that contains the addresses of the recipients of the email message. Multiple email addresses must be separated with a comma character (","). |
MailMessage(String,String,String,String)Constructor
Initializes a new instance of the MailMessage class.
| Parameter | Description |
|---|---|
| from | A String that contains the address of the sender of the email message. |
| to | A String that contains the addresses of the recipients of the email message. Multiple email addresses must be separated with a comma character (","). |
| subject | A String that contains the subject text. |
| body | A String that contains the message body. |