How to set SMTP header properties by using CDONTS

Article translations Article translations
Article ID: 233293 - View products that this article applies to.
This article was previously published under Q233293
Expand all | Collapse all


You can use Collaboration Data Objects for NTS (CDONTS) to set more header information for messages that are created by using CDONTS. The Value property of the NewMail object lets you add more header information to the NewMail object in CDONTS. To add the new header to the CDONTS message, you must assign the string to which the header is being set to the correct header name.

To do this, use the following syntax:
CDONTSNewMailObject.Value("Header String") = "Value that the header is being set to"				


To set the Reply-To property on a message that is sent by using CDONTS, follow these steps:
  1. Paste the following code sample into a Microsoft Visual Basic project.
    Private Sub Form_Load()
        Dim myCDONTSMail As CDONTS.NewMail
        Dim strFrom As String
        Dim strTo As String
        Dim strReply_To As String
        Dim strSubject As String
        Dim strMessage As String
         strFrom = ""
         strTo = ""
         strReply_To = "Reply-To<>"
         strSubject = "This is the Subject"
         strBody = "This is the message body." 
         ' Create the CDONTS NewMail object.   
         Set myCDONTSMail = CreateObject("CDONTS.NewMail")
         ' Set the Reply-To header of the Newmail object.
         myCDONTSMail.Value("Reply-To") = strReply_To
         ' Send the message and clean up CDONTS objects.    
         myCDONTSMail.Send strFrom, strTo, strSubject, strMessage
         Set myCDONTSMail = Nothing
    End Sub
  2. Add a reference to the CDONTS library to the project.
You can set the Value property more than one time. Every time that you set the Value property, another header is generated that will be included with the existing headers. For the headers to function correctly, the string that is added as a header exactly matches the accepted string.

A list of the accepted headers that can be used can be found in RFC 822.


For more information, visit the following Microsoft Developer Network (MSDN) Web site:
RFC 822


Article ID: 233293 - Last Review: June 21, 2005 - Revision: 2.0
  • Microsoft Collaboration Data Objects 1.2 for NT Server
kbfaq kbhowto kbmsg KB233293
Retired 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.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from