HTMLBody Property

HTMLBody Property

The HTMLBody property contains the HTML representation of the message.

Syntax

Property HTMLBody as String
HRESULT get_HTMLBody(BSTR* pVal);
HRESULT put_HTMLBody(BSTR Val);

Remarks

This property is also available as the urn:schemas:httpmail:htmldescription field.

To construct a Multipurpose Internet Mail Extensions (MIME) message that contains both plain text and Hypertext Markup Language (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 property to text/plain, and the second body part's ContentMediaType property 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 the HTMLBody property, Microsoft Collaboration Data Objects (CDO) automatically sets the TextBody property to the plain text equivalent.

If you set the MimeFormatted property 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 by 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 is currently an empty string, use the IMessage.HTMLBodyPart method to access the BodyPart object containing the HTML for the message.

The default value of the HTMLBody property is an empty string.

See Also

Concepts

htmldescription Field
HTMLBodyPart Property