Platform SDK: CDO 1.2.1

Value Property (CDONTS NewMail Object)

The Value property sets the value and contents of an additional header for the NewMail object. Write-only.

Syntax

objNewMail.Value(header) = strHdrValue 
 
header
A character string containing the name of the header to be added.
strHdrValue
A character string containing the value of the header to be added.

The Value property is the default property of a NewMail object, meaning that objNewMail(header) is syntactically equivalent to objNewMail.Value(header) in Microsoft® Visual Basic® code.

Data Type

String

Remarks

The Value property is used to add one or more headers to the automatically generated headers such as "To", "From", "Subject", and "Date". Possibilities for additional headers include "File", "Keywords", and "Reference".

Certain headers, such as "Reply-To", are widely accepted and used by various messaging systems. If you wish such a header to be recognized by the recipients of the NewMail object, you must be sure that the character string in the header's name exactly matches the accepted string.

In principle you can put any combination of ASCII characters in the string, but some messaging systems may have restrictions on the character set. The safest procedure is to limit the string to alphanumeric characters, dashes, and slashes, and in particular to avoid spaces.

You can set the Value property more than once. Each setting generates another header to be included with the existing headers.

Example

This code fragment adds two headers to a NewMail object before sending it:

  ' strBody set in advance for message body 
  objNewMail.Value("Reply-To") = "The Boss<myemail@microsoft.com>" 
  objNewMail.Value("Confidential") = "For my direct reports only" 
  objNewMail.Send "myemail@microsoft.com", _ 
                  "myreports@microsoft.com", _ 
                  "Reorganization", strBody, 2 ' high importance 
  Set objNewMail = Nothing