Article ID: 302839 - Last Review: February 12, 2007 - Revision: 3.3

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

This article was previously published under Q302839

On This Page

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:
http://msdn.microsoft.com (http://msdn.microsoft.com)

Keywords: 
kbhowto KB302839
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.

Note: This article is from Microsoft Knowledage Base


How we have helped PC users like you

In the News: Read More In ...

Related problems posted by other users

more...