Help and Support

Article ID: 286430 - Last Review: February 12, 2007 - Revision: 4.2

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

This article was previously published under Q286430
Expand all | Collapse all

SUMMARY

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("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
        ' TODO: Replace <PICKUP DIRECTORY> with path to your pickup directory
        ' Typically, c:\Inetpub\mailroot\pickup
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")="<PICKUP DIRECTORY>"
        .Update
    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 = "alias@domain.com"
       .From = "youralias@yourdomain.com"
       .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")
       .Send
    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.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
286431  (http://support.microsoft.com/kb/286431/EN-US/ ) How To Send HTML Formatted mail Using CDO for Windows 2000 and a Remote SMTP Service

APPLIES TO
  • Microsoft Collaboration Data Objects 2.0
  • Collaboration Data Objects for Exchange 2000
Keywords: 
kbhowto KB286430
Retired KB ArticleRetired 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.

Article Translations