Represents an e-mail message that can be sent using the SmtpClient class.
Assembly: System (in System.dll)
Initializes an empty instance of theclass.
Initializes a new instance of the MailAddress class objects.class by using the specified
Initializes a new instance of the String class objects.class by using the specified
|MailMessage(String, String, String, String)|
Initializes a new instance of theclass.
Gets the attachment collection used to store alternate forms of the message body.
Gets the attachment collection used to store data attached to this e-mail message.
Gets the address collection that contains the blind carbon copy (BCC) recipients for this e-mail message.
Gets or sets the message body.
Gets or sets the encoding used to encode the message body.
Gets or sets the transfer encoding used to encode the message body.
Gets the address collection that contains the carbon copy (CC) recipients for this e-mail message.
Gets or sets the delivery notifications for this e-mail message.
Gets or sets the from address for this e-mail message.
Gets the e-mail headers that are transmitted with this e-mail message.
Gets or sets the encoding used for the user-defined custom headers for this e-mail message.
Gets or sets a value indicating whether the mail message body is in Html.
Gets or sets the priority of this e-mail message.
Obsolete.Gets or sets the ReplyTo address for the mail message.
Gets or sets the list of addresses to reply to for the mail message.
Gets or sets the sender's address for this e-mail message.
Gets or sets the subject line for this e-mail message.
Gets or sets the encoding used for the subject content for this e-mail message.
Gets the address collection that contains the recipients of this e-mail message.
Releases all resources used by the.
Releases the unmanaged resources used by theand optionally releases the managed resources.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Returns a string that represents the current object.(Inherited from Object.)
Instances of the SmtpClient class.class are used to construct e-mail messages that are transmitted to an SMTP server for delivery using the
The sender, recipient, subject, and body of an e-mail message may be specified as parameters when a MailMessage is used to initialize a object. These parameters may also be set or accessed using properties on the object.
The primary mail message headers and elements for the message may be set using the following properties of theclass.
Mail header or part
Blind carbon copies (BCC)
Carbon copies (CC)
Encoding for custom headers
The Headers property. While this collection is read-only (a new collection can not be set), custom headers can be added to or deleted from this collection. Any custom headers added will be included when the instance is sent. Before a message is sent, only headers specifically added to this collection in the Headers property are included in the collection. After a the instance is sent, the Headers property will also include headers that are set using the associated properties of the class or parameters passed when a MailMessage is used to initialize a object.class also allows an application to access the headers collection for the message using the
If some mail headers are malformed, they could cause the email message to become corrupted. So any mail header in the headers collection that can be set using a property on the MailMessage initializes a object. The following list of mail headers should not be added using the Headers property and any values set for these headers using the Headers property will be discarded or overwritten when the message is sent:class should only be set using the class property or as a parameter passed when a
If the application does not specify an X-Sender header using the Headers property, the class will create one when the message is sent.
Use the AlternateViews property to specify copies of an e-mail message in different formats. For example, if you send a message in HTML, you might also want to provide a plain text version in case some of the recipients use e-mail readers that cannot display HTML content. For an example that demonstrates creating a message with alternate views, see AlternateViews.
Available since 2.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.