Share via


HTMLBody Property

Topic Last Modified: 2006-12-01

The HTML representation of the message.

Applies To

IMessage Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Property HTMLBody As String

HRESULT get_HTMLBody(BSTR* pVal);HRESULT put_HTMLBody(BSTR Val);

Parameters

  • pVal
    Returns the value of the HTMLBody property as a reference to a BSTR.
  • Val
    Sets the value of the HTMLBody property to the value of the BSTR.

Remarks

This property is also available as the htmldescription Field entry in the schema.

To construct a Multipurpose Internet Mail Extensions (MIME) message containing both the plain text and HTML versions of the body, you can set the message's ContentMediaType property on the IBodyPart interface to "multipart/alternative", the first body part's ContentMediaType to "text/plain", and the second body part's ContentMediaType to "text/richtext" or "text/html". Alternatively, you can use the AutoGenerateTextBody and MimeFormatted properties to automate some of this process. When these properties are both True and you set HTMLBody, Collaboration Data Objects (CDO) automatically sets the TextBody property to the plain text equivalent.

If you set MimeFormatted to False, the HTMLBody property is removed from the message and the HTML text is lost.

To access the corresponding plain text string, use the TextBody property.

You can access the BodyPart object containing the HTML for the message using the IMessage.HTMLBodyPart property.

The HTMLBody property returns an empty string if it has never been set. If you need to determine whether this is the case or whether the HTML text is present but currently an empty string, use the IMessage.HTMLBodyPart method to access the BodyPart object containing the HTML for the message.

The default value of HTMLBody is an empty string.

See Also

Other Resources

htmldescription Field
HTMLBodyPart Property