How To Send a Delivery Status Notification by Using CDO for Windows 2000 (302839)



The information in this article applies to:

  • Collaboration Data Objects for Exchange 2000
  • Microsoft Collaboration Data Objects for Windows 2000

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.

MORE INFORMATION

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("cdo.message")
set iconf = createobject("cdo.configuration")

Set Flds = iConf.Fields
With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "<SMTP Server>" 'ToDo: Type a valid SMTP server name.
    .Update
End With

strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "<hr>"
strHTML = strHTML & "This another section of the message...</BR>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

With iMsg
    Set .Configuration = iConf
    .To = "<valid e-mail address>"  'ToDo: Type a valid e-mail address.
    .From = "<valid e-mail address>" 'ToDo: Type a valid e-mail address.
    .Subject = "This is a test CDOSYS message (Setting DSN options)"
    .HTMLBody = strHTML
    .fields("urn:schemas:mailheader:disposition-notification-to") = "<valid e-mail address>" 'ToDo: Type a valid e-mail address.
    .fields("urn:schemas:mailheader:return-receipt-to") = "<valid e-mail address>"  '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
				

REFERENCES

For more information about the Delivery Status Notification (DSN) options, visit the following Microsoft Web site:

Modification Type:MinorLast Reviewed:8/25/2005
Keywords:kbhowto KB302839