How to migrate the Collaboration Data Objects for NTS applications to Microsoft Collaboration Data Objects for Windows 2000

This article has been archived. It is offered "as is" and will no longer be updated.
This step-by step article describes how to migrate existing code based on the CDONTS object model to CDOSYS.

You can use the Cdonts.dll and Cdosys.dll object libraries to create and process e-mail by using Internet standard formats and protocols. Collaboration Data Objects for NTS (CDONTS) was originally implemented to use with Microsoft Commercial Internet Server (MCIS), and was included in the Windows NT Option Pack. CDONTS was also included as part of Windows 2000 for compatibility with Windows NT. CDONTS is not included with Microsoft Windows XP and subsequent releases of Windows. Microsoft Collaboration Data Objects for Windows 2000 (CDOSYS) was implemented and included as a Windows 2000 operating system component. The existing code that is based on CDONTS must migrate to CDOSYS.


The following table compares operating system (OS) support and feature support in the Cdonts.dll and the Cdosys.dll libraries.
Windows NT supportyesnoNeither included with OS
Windows 2000 supportyesyesBoth included with OS
Windows XP supportnoyesCDOSYS only included with OS
Exchange server supportyesyes
Send mailyesyes
Post to newsgroupnoyes
Send (post) by using Simple Mail Transfer Protocol (SMTP) Network News Transfer Protocol (NNTP) port noyes
MIME and Uuencode message formats yesyes
Explicit control of MIME body part structure, encoding, charset, and others. noyes
HTML and MHTML support yesyes
List / read local drop directory noyes
List / read inbox through POP3 yesno
Transport event sink support noyes
Reply and forward functionsnoyes


The following examples demonstrate how to perform the same task by using CDONTS and by using CDOSYS. Each of the following examples describes a feature that both libraries have, and then gives sample code for implementing the feature in each library. These code samples were verified by using Windows 2000 Service Pack 2 (SP2) and the following versions of the libraries:
  • CDONTS 6.0.3939.0
  • CDOSYS 6.0.3943.3

Simple send

This example is the most popular use for both libraries. In this case, both libraries write the message to the pickup directory of the SMTP server. The directory path is read from the local metabase.
CDONTS example
 set m =CreateObject("CDONTS.NewMail") m.Send "", _"", _ "test 1", _ "hello there" 
CDOSYS example
 Set m =CreateObject("CDO.Message") m.From = "" m.To ="" m.Subject = "test 1" m.TextBody = "hello there"m.send

Send HTML body

The following examples put HTML body text in the message. Otherwise, these examples are similar to the "Simple Send" examples. In both sets of examples, MIME multipart/alternative message format is used. Also, a plain text body is automatically created from the HTML. The plain text body is included as a text/plain body part.
CDONTS example
 sHTML = "<html><body><fontcolor=""#FF0000"">" & _ "hello,Red</font></body></html>" Set m =CreateObject("CDONTS.NewMail") m.MailFormat = 0 ' CdoMailFormatMimem.BodyFormat = 0 ' CdoBodyFormatHTML m.Send "", _"", _ "test 1", _ sHTML 
 sHTML = "<html><body><fontcolor=""#FF0000"">" & _ "hello,Red</font></body></html>" Set m = CreateObject("CDO.Message")m.From = "" m.To = "" m.Subject = "test 1"m.HtmlBody = sHTML m.send

Send with an attachment in MIMEformat

CDONTS example
Set m = CreateObject("CDONTS.NewMail") m.MailFormat = 0 ' CdoMailFormatMimem.AttachFile "d:\ptsp\test\test.doc" m.Send "", _"", _ "test.doc", _ "Here is the document yourequested"
CDOSYS example
 Set m= CreateObject("CDO.Message") m.From = "" m.To ="" m.Subject = "test.doc" m.TextBody = "Here is the documentyou requested." m.AddAttachment "file://d:\ptsp\test\test.doc"m.send

Send with an attachment in Uuencode format

For both libraries, to send the message with an attachment in Uuencode, change a property on the message to change the format.
CDONTS example
 Set m =CreateObject("CDONTS.NewMail") m.MailFormat = 1 ' CdoMailFormatTextm.AttachFile "d:\ptsp\test\test.doc" m.Send "", _"", _ "test.doc", _ "Here is the document you requested"
CDOSYS example
 Set m =CreateObject("CDO.Message") m.MimeFormatted = false m.From ="" m.To = "" m.Subject = "test.doc"m.TextBody = "Here is the document you requested." m.AddAttachment"file://d:\ptsp\test\test.doc" m.send

Send Unicode message text

This example includes a Unicode character (the Euro symbol, €, Unicode code point 0x20ac) in the display name of the recipient and in the message text. In both examples, "€" is encoded into the utf-7 CharSet property. CDONTS must use the CP_UTF7=65000 constant. For CDOSYS, the CharSet name is unicode-1-1-utf-7.
CDONTS example
 Set s = CreateObject("CDONTS.Session") S.LogonSMTP "User 1","" s.SetLocaleIDs 65000 ' cpUTF7 Set m = s.Outbox.Messages.Addm.MessageFormat = 0 ' CdoMime set r = m.Recipients.Add 'r.address ="" = "Joe €" r.address = "<>"m.Subject = "Unicode content" m.Text = "That will be €5, please."m.Send
CDOSYS example
set m =CreateObject("CDO.Message") m.From = "User1 <>" m.To ="Joe € <>" m.Subject = "Unicode content" set b =m.bodypart b.charset = "unicode-1-1-utf-7" m.textbody = "That will be €5,please." m.send
For more information, visit the following MSDN Web sites: For more information, click the following article number to view the article in the Microsoft Knowledge Base:
816789 Read access to the Everyone group is removed after you install Exchange 2000 Service Pack 3

Article ID: 810702 - Last Review: 02/27/2014 18:43:05 - Revision: 7.0

  • Microsoft Exchange Server 2003 Enterprise Edition
  • Microsoft Exchange Server 2003 Standard Edition
  • Microsoft Exchange 2000 Server Standard Edition
  • kbnosurvey kbarchive kbhowtomaster kbhowto KB810702