Microsoft KB Archive/286430

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

Article ID: 286430

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Collaboration Data Objects 2.0
 * Collaboration Data Objects for Exchange 2000

-



This article was previously published under Q286430



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
  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(&quot;CDO.Message&quot;) set iConf = CreateObject(&quot;CDO.Configuration&quot;)

Set Flds = iConf.Fields With Flds .Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = cdoSendUsingPickup ' TODO: Replace  with path to your pickup directory ' Typically, c:\Inetpub\mailroot\pickup .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory&quot;)=&quot;&quot; .Update End With

' Build HTML for message body. strHTML = &quot;&quot; strHTML = strHTML & &quot;&quot; strHTML = strHTML & &quot;&quot; strHTML = strHTML & &quot; This is the test HTML message body &quot; strHTML = strHTML & &quot;&quot; strHTML = strHTML & &quot;&quot;

Dim iBP With iMsg Set .Configuration = iConf .To = &quot;alias@domain.com&quot; .From = &quot;youralias@yourdomain.com&quot; .Subject = &quot;This is a test CDOSYS message (Sent via Pickup)&quot; .HTMLBody = strHTML 'TODO: if adding an attachment, 'uncomment the next line and alter file path as required 'Set iBP = iMsg.AddAttachment(App.Path & &quot;\file1.txt&quot;) .Send End With

' Clean up variables. Set iBP = Nothing Set iMsg = Nothing Set iConf = Nothing Set Flds = Nothing

MsgBox &quot;Mail Sent!&quot;  Edit the sections of the code that are marked &quot;ToDo&quot;. Save the file, and then double-click it.

This script generates an HTML formatted message and sends it using the pickup directory.</li></ol>

<div class="references_section">