Search code examples
vb6windows-server-2012mapicdo.message

What are the prerequisites for installing CDO.DLL in Windows Server 2012 for VB application


I am upgrading a server from Windows 2003 to 2012 R2. One of our VB6 applications used CDO.dll for MAPI, i.e. for sending mails.

My question is :

  1. How do I install/register CDO.DLL?

  2. What are the prerequisites for installing CDO.DLL?

  3. Do I need to install Outlook in my server for the application to send mail?

Set objMAPI = New MAPI.Session
objMAPI.Logon ShowDialog:=False, NewSession:=False, ProfileInfo:=gobjINI.gstrExchangeServer & vbLf & gobjINI.gstrProfile
'Add a new mesage to the OUtbo Messages Collection
Set objMSG = objMAPI.Outbox.Messages.Add
'Add the recipient list specified in INI File
'Check if this is a multiple Recipient List (names or groups seperated by semicolons!)
If InStr(1, Recipients, ";") Then
  objMSG.Recipients.AddMultiple Recipients, CdoTo
  objMSG.Recipients.Resolve
Else
  'This section is for handling of single recipient name
  'Be aware that this may be an email group list name !
  Set objRecipients = objMSG.Recipients.Add(Recipients)
  objRecipients.Resolve
End If

'Add Subject Line, Message Content and Send Message
objMSG.Subject = Subject
objMSG.Text = Message

'The Update method adds all our assignments to collecttion
objMSG.Update

'Now let's actually send the message
objMSG.Send

'End MAPI Session
objMAPI.Logoff
Set objMAPI = Nothing

MailSend = True

Solution

  • CDO 1.21 is no longer being developed or supported by Microsoft. You can download the standalone version of MAPI along with CDO 1.21 from https://www.microsoft.com/en-us/download/details.aspx?id=42040. It was last updated in 2014 and no new bug fixes are expected. Functionality wise it has not been updated for the last 15 years.

    You can switch to the Outlook Object Model (Namespace object roughly corresponds to the MAPI.Session object).

    You can also use Redemption (I am its author) - its RDOSession object is similar to the MAPI.Session object (with a lot more extra features).