About: CDO for Windows 2000 (CDOSYS)

API Type:  SMTP Sender.
API Interface:  COM Library.
Business Logic: Sending mail via SMTP
Language Support: Works with both managed (.NET) and unmanaged code and scripting languages such as VBScript.
Direct Property Access:  N/A.
Product Versions: Windows 2000 and later.

Summary:

CDOSYS has been a system component used to send email since Windows 2000.  It was meant to replace CDONTS.  It's primary function is an SMTP mailer which is used to send email by a port or local SMTP port.  This API is still used widely today. It is supported under .NET, however you should follow the rules proper releasing the underlying COM objects when used under .NET (i.e. calling ReleaseComObject. Older versions of .NET used System.Web.Mail to send email and it was actually a .NET wrapper for CDOSYS, however it had very limited functionality.  In later versions .NET included a replacement for System.Web.Mail which was written to send email using sockets calls and was writing fully in .NET - its called System.Net.Mail (SNM).  While System.Net.Mail has many useful features there are some things which CDOYS would need to be used - an example of this is loading an .eml file and parsing it.

Backgrounders:

Collaboration Data Objects for Windows 2000 (CDOSYS)
https://msdn.microsoft.com/en-us/library/cc161087(v=exchg.65).aspx

CDO for Windows 2000
https://msdn.microsoft.com/en-us/library/ms527568(v=exchg.10).aspx

About CDO for Windows 2000
https://msdn.microsoft.com/en-us/library/ms527525(v=exchg.10).aspx

How to migrate the Collaboration Data Objects for NTS applications to Microsoft Collaboration Data Objects for Windows 2000
https://support.microsoft.com/kb/810702

Support policy for Microsoft Exchange APIs with the .NET Framework applications
https://support.microsoft.com/default.aspx?scid=kb;en-us;813349 

Use with Programming Languages:

 

Unmanaged C++

YES

VB6

YES

Managed Code (.NET)

YES

 

 

Can Run Under:

Running Under Windows Service

YES

Running Under IIS

YES

Running Under COM+

YES

Running in a Web Service

YES

 

Sends Via:

 

Send Via MAPI Provider

NO

Sending Via SMTP Pickup

YES

Sending Via SMTP Port

YES

Sending Via Submission URL

NO

Can Save Sent Mail in Sent Items folder

NO

 

Some Points Of Interest:

  • Works with .NET. 
  • It's a Windows component. 
  • Because its a windows component you should not include the CDOSYS DLL in your application.  The same goes for ADODB which will automatically get referenced when you set a reference to CDOSYS.
  • Can build complex email.
  • Can load and parse an email (email) file.
  • Older versions of Exchange included an API called CDOEX, which was a super-set of CDOSYS.  In addition to what CDOSYS could do, CDOEX could be used for working with items in a mailbox.
  • The older versions of Windows included a mail client called Outlook Express which used CDOSYS to send email.
  • Sending email by SMTP pickup folder is more efficient than sending by SMTP port.  This approach is recommended when sending a lot of email.  
  • CDOSYS can send email against more variations of SSL enabled ports than System.Net.Mail.
  • System.Web.Mail was an early .NET wrapper for CDOSYS, however it did not expose all the capabilities of CDOSYS. Later a full .NET sockets based SMTP sender called System.Net.Mail was created which replaced System.Web.Mail. System.Net.Mail has some features which CDOSYS does not, however it does not fully replace the capabilities which CDOSYS has.

Homework if you wish to know more:

System.Net.Mail with SSL to authenticate against port 465
https://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx

How to send digitally signed messages by using CDOSYS/CDOEX
https://support.microsoft.com/en-us/kb/280391/

How to use the Cdosys.dll library to embed a message in a new message by using Visual C#
https://support.microsoft.com/en-us/kb/310221/

How to use the CDOSYS Library to send an e-mail message by using the SMTP port in Visual Basic .NET
https://support.microsoft.com/en-us/kb/313775/

How to use the Cdosys.dll library to send an e-mail message with attachments by using Visual C#
https://support.microsoft.com/en-us/kb/310212/

Building VCALENDAR content without an Microsoft API is not supported by MS.
https://blogs.msdn.com/b/webdav_101/archive/2008/02/26/building-vcalendar-and-ical-is-not-supported-by-ms.aspx

Howto: CDOSYS/C# Sending an ICS file
https://blogs.msdn.com/b/webdav_101/archive/2008/05/05/howto-cdosys-c-sending-an-ics-file.aspx

Enumerating fields for CDOSYS, System.Web.Mail and System.Net.Mail
https://blogs.msdn.com/b/webdav_101/archive/2008/08/14/enumerating-fields-for-cdosys-system-web-mail-and-system-net-mail.aspx

Example of setting headers with CDOSYS
https://blogs.msdn.com/b/webdav_101/archive/2008/07/16/example-of-setting-headers-with-cdosys.aspx

Howto: Add a body part to a message using CDOSYS.
https://blogs.msdn.com/b/webdav_101/archive/2008/07/16/howto-add-a-body-part-to-a-message-using-cdosys.aspx

HOWTO: Set and Get the a multibyte (Japanese, Chinese, Etc) custom header with CDOSYS
https://blogs.msdn.com/b/webdav_101/archive/2008/07/24/howto-set-and-get-the-a-multibyte-japanese-chinese-custom-header-with-cdosys.aspx

Adding Inline Attachments with CDOSYS and System.Net.Mail.
https://blogs.msdn.com/b/webdav_101/archive/2008/07/31/adding-inline-attachments-with-cdosy-and-system-net-mail.aspx

CDOSYS breaks after removing Outlook Express.
https://blogs.msdn.com/b/webdav_101/archive/2008/05/06/cdosys-breaks-after-removing-outlook-express.aspx

Why is CDOSYS failing in a stored procedure?
https://blogs.msdn.com/b/webdav_101/archive/2008/02/01/why-is-cdosys-failing-in-a-stored-proceedure.aspx

How to send e-mail without using SQL Mail in SQL Server
https://support.microsoft.com/en-us/kb/312839/

CDO for Windows 2000 Library reference is unavailable in Visual Basic Project
https://support.microsoft.com/en-us/kb/318823/

Where to acquire the CDO Libraries (all versions)
https://support.microsoft.com/kb/171440/EN-US  

Note that most examples of CDOSYS used under .NET do not release memory properly - ie call ReleaseComObject. Be sure to always do this and always test sending many email at tone time while testing.

Large samples:

CDOSYS Mailer
https://blogs.msdn.com/b/webdav_101/archive/2015/05/01/cdosys-mailer.aspx

CDOSYS Mailer
https://cdosysmailer.codeplex.com/

CDOSYS Mime Parser
https://cdosysmimeparser.codeplex.com/ 

Also see:

About: SMTP Sending APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/05/28/about-smtp-sending-apis.aspx

About: Messaging APIs
https://blogs.msdn.com/b/webdav_101/archive/2015/08/07/about-messaging-apis.aspx

Comments

  • Anonymous
    September 03, 2015
    Thanks for the helpful links. Where is the MS reference for CDOSys? Is there one? I keep finding the 2004 dated CDO 1.2.1. Also, I am using CDOsys in VBA - running from Excel. It works great but if I send multiple messages, after completion, Excel hangs - sort of. It is running but the window does not repaint. If I use alt-tab or the Toolbar, I can select Excel. I press <alt +f> and the legacy menu items show up. I then press "S" for save. Then "Enter" - upon pressing Enter, the Excel sheet appears. I am sending to between 1 and 200 emails. That works great. And I log/timestamp each email row and save the sheet. Those changes all get saved - the email goes out - etc. The process concludes. Everything works minus the re-painting of the screen. I am not turning on or off screen updates - it isn't that. In any case, any ideas.. or.. here is sort of the process/routine. Pseudo code just to show that I use one configuration object and create and end the cdo message for each email. ============== ============== Sub ProcessEmailSheet Create CDO Config object - cdoConf
  • fill the CDO config fields While items to be processed SendMyMessage cdoConf, tofields, etc. End While End Sub ============== Sub SendMyMessage(inCDOConf, intofields, etc.) create cdo Message object cdoMsg cdoMsg.configuration = inCDOConf cdoMsg.To (and other fields get set) cdoMsg.Send Set cdoMsg = Nothing End Sub