HOWTO: Send an HTML Message Using MAPI and CDO

ID: Q216344


The information in this article applies to:


SUMMARY

Microsoft Outlook 98 has the ability to send, receive, and render e-mail messages with bodies of different types. Such types include Plain Text, Rich Text Format (RTF), and HyperText Markup Language (HTML). This article shows how to convert the RTF formatted message content to HTML, programmatically.


MORE INFORMATION

Sending an HTML-based message is very similar to sending a message in Rich Text Format. The only difference is that you need to modify the stream to indicate that it is from HTML instead of plain text or RTF.

The RTF stream is made up of the plain text of the message as well as several tags that tell Outlook how to render the message. The following tags are used for rendering the different formats supported by Outlook:


Changing the contents of your message to HTML requires you to wrap your HTML text in an RTF stream and then pre-pend the \fromhtml1 tag to the beginning of the stream. Assuming that you have a pointer to an RTF stream in a Microsoft Visual Basic program, the code would look very similar to the following:

Dim strRTFStream as String 
strRTFStream = "\fromhtml1" & strRTFStream 


REFERENCES

For additional information about creating and storing message text to an RTF stream, please see the following article in the Microsoft Knowledge Base:

Q172038 FILE: DLL to Read and Write RTF with Active Messaging

Additional query words: kbCDO121 kbMsg kbMAPI100


Keywords          : kbhtml kbCDO121 kbMsg kbMAPI100 kbGrpMsg 
Version           : WINDOWS:1.0,1.21
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: April 7, 1999