How To Send HTML Formatted Mail Using CDO for Windows 2000 and the Local Pickup Directory

Article translations Article translations
Article ID: 286430
Expand all | Collapse all


This article describes how to send HTML formatted mail through the local pickup directory using CDO for Windows 2000 (CDOSYS) or CDO for Exchange 2000 (CDOEX).

More information

  1. Create a file called Cdopickup.vbs and paste the following code:
    'Send using the Pickup directory on the IIS server.
    Dim iMsg 
    Dim iConf 
    Dim Flds 
    Dim strHTML
    Const cdoSendUsingPickup = 1
    set iMsg = CreateObject("CDO.Message")
    set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    With Flds 
        .Item("") = cdoSendUsingPickup
        ' TODO: Replace <PICKUP DIRECTORY> with path to your pickup directory
        ' Typically, c:\Inetpub\mailroot\pickup
        .Item("")="<PICKUP DIRECTORY>"
    End With
    ' Build HTML for message body.
    strHTML = "<HTML>"
    strHTML = strHTML & "<HEAD>"
    strHTML = strHTML & "<BODY>"
    strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
    strHTML = strHTML & "</BODY>"
    strHTML = strHTML & "</HTML>"
    Dim iBP
    With iMsg
       Set .Configuration = iConf
       .To = ""
       .From = ""
       .Subject = "This is a test CDOSYS message (Sent via Pickup)"
       .HTMLBody = strHTML
       'TODO: if adding an attachment,
       'uncomment the next line and alter file path as required
       'Set iBP = iMsg.AddAttachment(App.Path & "\file1.txt")
    End With
    ' Clean up variables.
    Set iBP = Nothing
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    MsgBox "Mail Sent!"
  2. Edit the sections of the code that are marked "ToDo".
  3. Save the file, and then double-click it.

    This script generates an HTML formatted message and sends it using the pickup directory.


For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
286431 How To Send HTML Formatted mail Using CDO for Windows 2000 and a Remote SMTP Service


Article ID: 286430 - Last Review: June 19, 2014 - Revision: 5.0
kbhowto KB286430
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from