Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
CDO automatically sets the fields needed for typical MIME messages. For example, when you create IMessage.HTMLBody with the IMessage.AutoGenerateTextBody property set to True, IMessage.TextBody is automatically generated along with the appropriate MIME structure. The IBodyPart.ContentMediaType for the root part is automatically set to multipart/alternative, with the two subparts being set to text/plain and text/html.
For more complex MIME-formatted messages, you may need to set the header fields directly. All fields are stored in an ADO Fields collection as name/value pairs. The mail header fields used with body parts reside in the urn:schemas:mailheader: namespace. Common fields such as urn:schemas:mailheader:content-type are also exposed as properties of the IBodyPart interface.
The following example shows how to set the ADO field urn:schemas:mailheader:content-language of the root body part of a simple message to German ("de").
' Reference to Microsoft ActiveX Data Objects 2.5 Library ' Reference to Microsoft CDO for Exchange 2000 Server Library ' .. Dim iMsg As New CDO.Message Dim iBp As CDO.IBodyPart Set iBp = iMsg Dim Flds as ADODB.Fields Set Flds = iBp.Fields Flds("urn:schemas:mailheader:content-language") = "de" Flds.Update
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace #import "c:\exchsrvr\cdoex.dll" no_namespace // ... IMessagePtr iMsg(__uuidof(Message)); IBodyPartPtr iBp; FieldsPtr Flds; iBp = iMsg; Flds = iBp->Fields; Flds->Item["urn:schemas:mailheader:content-language"] = _variant_t("de"); Flds->Update();
Dim iMsg Dim iBp Set iBp = iMsg.BodyPart Dim Flds Set Flds = iBp.Fields Flds("urn:schemas:mailheader:content-language") = "de" Flds.Update
urn:schemas:mailheader:content-type Field