CMailMessage::SetHeader Method  
 
BOOL SetHeader(
  INT nMessagePart,  
  LPCTSTR lpszHeader,  
  LPCTSTR lpszValue  
);
BOOL SetHeader(
  LPCTSTR lpszHeader,  
  LPCTSTR lpszValue  
);

The SetHeader method adds or updates a header field in the specified message.

Parameters

nMessagePart
An integer value which specifies which part of the message the header should be set or modified in. A value of zero sets a header value in the main message header block, while a value greater than zero sets the header value in that specific part of a multipart message. If this argument is omitted or a value of -1 is specified, the header value will be set in the current message part.
lpszHeader
Pointer to a string which specifies the header field that will be added or updated.
lpszValue
Pointer to a string which specifies the value for the header field. This pointer may be NULL, which causes the header field to be removed from the message.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: csmsgv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

AddHeaders, EnumHeaders, GetFirstHeader, GetHeader, GetPart, GetNextHeader, SetPart, SetText