This documentation is archived and is not being maintained.

MailMessage Class

Note: This API is now obsolete.

Provides properties and methods for constructing an e-mail message. Recommended alternative: System.Net.Mail.

System::Object
  System.Web.Mail::MailMessage

Namespace:  System.Web.Mail
Assembly:  System.Web (in System.Web.dll)

[ObsoleteAttribute(L"The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202")]
public ref class MailMessage

The MailMessage type exposes the following members.

  NameDescription
Public methodMailMessageInitializes a new instance of the MailMessage class. Recommended alternative: System.Net.Mail.
Top

  NameDescription
Public propertyAttachmentsSpecifies the collection of attachments that are transmitted with the message. Recommended alternative: System.Net.Mail.
Public propertyBccGets or sets a semicolon-delimited list of email addresses that receive a blind carbon copy (BCC) of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyBodyGets or sets the body of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyBodyEncodingGets or sets the encoding type of the body of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyBodyFormatGets or sets the content type of the body of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyCcGets or sets a semicolon-delimited list of e-mail addresses that receive a carbon copy (CC) of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyFieldsGets a collection of objects that map to Microsoft Collaboration Data Objects (CDO) fields. Recommended alternative: System.Net.Mail.
Public propertyFromGets or sets the e-mail address of the sender. Recommended alternative: System.Net.Mail.
Public propertyHeadersSpecifies the custom headers that are transmitted with the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyPriorityGets or sets the priority of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertySubjectGets or sets the subject line of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyToGets or sets a semicolon-delimited list of recipient e-mail addresses. Recommended alternative: System.Net.Mail.
Public propertyUrlContentBaseGets or sets the Content-Base HTTP header, the URL base of all relative URLs used within the HTML-encoded body of the e-mail message. Recommended alternative: System.Net.Mail.
Public propertyUrlContentLocationGets or sets the Content-Location HTTP header for the e-mail message. Recommended alternative: System.Net.Mail.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The following example shows how to use the MailMessage class.

Security noteSecurity Note

This control has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 1.1, 1.0
Obsolete (compiler warning) in 4
Obsolete (compiler warning) in 3.5
Obsolete (compiler warning) in 3.5 SP1
Obsolete (compiler warning) in 3.0
Obsolete (compiler warning) in 3.0 SP1
Obsolete (compiler warning) in 3.0 SP2
Obsolete (compiler warning) in 2.0
Obsolete (compiler warning) in 2.0 SP1
Obsolete (compiler warning) in 2.0 SP2

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: