Platform SDK: Exchange 2000 Server

AutoGenerateTextBody Property

[This is preliminary documentation and subject to change.]

Indicates whether the TextBody of a message should automatically be generated from the contents of the HTMLBody property for a multipart/alternative message.

[Visual Basic]
Property AutoGenerateTextBody as Boolean
[C++]
HRESULT get_AutoGenerateTextBody(VARIANT_BOOL* pVal);
HRESULT put_AutoGenerateTextBody(VARIANT_BOOL Val);
[IDL]
HRESULT [propget] AutoGenerateTextBody([out,retval] VARIANT_BOOL* pVal);
HRESULT [propput] AutoGenerateTextBody([in] VARIANT_BOOL Val);

Remarks

If the AutoGenerateTextBody property is True (VARIANT_TRUE), the contents of the TextBody property are replaced by the plain text equivalent of the HTMLBody property; that is, the TextBody is the HTMLBody content with all HTML markup removed.

The following rules apply to the AutoGenerateTextBody property if it is set to True:

When using the AutoGenerateTextBody functionality, always update the HTML version of the message body. Updating the plain text will not cause new HTML to be generated.

For messages that contain other alternate representations besides HTML and plain text, you must create or update each manually.

The default value of AutoGenerateTextBody is True (VARIANT_TRUE) on newly created messages and False (VARIANT_FALSE) on previously existing messages.

Example

This code takes advantage of the default settings of the AutoGenerateTextBody and IMessage.MimeFormatted properties to send a message with both plain text and HTML versions of the same text:

[Visual Basic]
Dim iMsg as New CDO.Message 
Dim strHTML as String
strHTML  = "<HTML><h1>Hello There</h1></HTML>"
Set iMsg = New CDO.Message
With iMsg
  .To      = "Somebody@microsoft.com"
  .From    = "another@microsoft.com"
  .Subject = "Sample multipart/alternative message" 
  .HTMLBody = strHTML ' .TextBody gets generated automatically 
  .Send
End With
[C++,IDL]
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import <cdoex.dll> no_namespace

void main() {
 CoInitialize(NULL);
   IMessagePtr iMsg(__uuidof(Message));
   _bstr_t html   = "<HTML><h1>Hello There</h1></HTML>";
   iMsg->To       = "Somebody@microsoft.com" ; 
   iMsg->From     = "another@microsoft.com" ;
   iMsg->Subject  = "Sample multipart/alternative message" ;
   iMsg->HTMLBody = strHTML;
   iMsg->Send();
   iMsg = NULL;
  CoUninitialize();
}
[VBScript]
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim strHTML
strHTML  = "<HTML><h1>Hello There</h1></HTML>"
With iMsg
  .To      = "Somebody@microsoft.com"
  .From    = "another@microsoft.com"
  .Subject = "Sample multipart/alternative message" 
  .HTMLBody = strHTML ' .TextBody gets generated automatically 
  .Send
End With