Microsoft KB Archive/302839

= How To Send a Delivery Status Notification by Using CDO for Windows 2000 =

Article ID: 302839

Article Last Modified on 2/12/2007

-

APPLIES TO


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

-



This article was previously published under Q302839



SUMMARY
This article contains a Microsoft Visual Basic Scripting Edition (VBScript) sample that you can use to send a message with a request for a Delivery Status Notification (DSN) and a read-receipt.

NOTE: You can only send a message with a request for a Delivery Status Notification and a read-receipt when you use the cdoSendUsingPort method of delivery. You cannot do this when you send the e-mail message through the Pickup directory of the local Simple Mail Transfer Protocol (SMTP) server.



Sample to Send Message with Request for Delivery Status Notification and Read-Receipt
'Send by using the port on an SMTP server. Dim iMsg Dim iConf Dim Flds Dim strHTML

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;) = 2 .Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;&quot; 'ToDo: Type a valid SMTP server name. .Update End With

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;This another section of the message...&quot; strHTML = strHTML & &quot;&quot; strHTML = strHTML & &quot;&quot;

With iMsg Set .Configuration = iConf .To = &quot;&quot; 'ToDo: Type a valid e-mail address. .From = &quot;&quot; 'ToDo: Type a valid e-mail address. .Subject = &quot;This is a test CDOSYS message (Setting DSN options)&quot; .HTMLBody = strHTML .fields(&quot;urn:schemas:mailheader:disposition-notification-to&quot;) = &quot;&quot; 'ToDo: Type a valid e-mail address. .fields(&quot;urn:schemas:mailheader:return-receipt-to&quot;) = &quot;&quot; 'ToDo: Type a valid e-mail address. 'Set DSN options. '   Name                   Value       Description '   cdoDSNDefault             0       No DSN commands are issued. '   cdoDSNNever               1       No DSN commands are issued. '   cdoDSNFailure             2       Return a DSN if delivery fails. '   cdoDSNSuccess             4       Return a DSN if delivery succeeds. '   cdoDSNDelay               8       Return a DSN if delivery is delayed. '   cdoDSNSuccessFailOrDelay  14      Return a DSN if delivery succeeds, fails, or is delayed.

.DSNOptions = cdoDSNSuccessFailOrDelay .DSNOptions = 14 .fields.update .Send End With

