CImapClient::GetHeaderValue Method  
 
INT GetHeaderValue(
  UINT nMessageId,  
  UINT nMessagePart,  
  LPCTSTR lpszHeader,  
  LPTSTR lpszValue,  
  INT nMaxLength  
);
INT GetHeaderValue(
  UINT nMessageId,  
  LPCTSTR lpszHeader,  
  LPTSTR lpszValue,  
  INT nMaxLength  
);
INT GetHeaderValue(
  UINT nMessageId,  
  UINT nMessagePart,  
  LPCTSTR lpszHeader,  
  CString& strValue  
);
INT GetHeaderValue(
  UINT nMessageId,  
  LPCTSTR lpszHeader,  
  CString& strValue  
);

The GetHeaderValue method returns the value of a header field in the specified message.

Parameters

nMessageId
Number of message to retrieve header value from. This value must be greater than zero. The first message in the mailbox is message number one.
nMessagePart
The message part that the header value will be retrieved from. Message parts start with a value of one. A value of zero specifies that the RFC822 header field for the message will be used.
lpszHeader
Pointer to a string which specifies the message header to retrieve. The colon should not be included in this string.
lpszValue
Pointer to a string buffer that will contain the value of the specified message header.
nMaxLength
The maximum number of characters that may be copied into the buffer, including the terminating null character.

Return Value

If the method succeeds, it returns the length of the header field value. If the header field is not present in the message, the method will return a value of zero. If the method fails, the return value is IMAP_ERROR. To get extended error information, call GetLastError.

Remarks

The GetHeaderValue method returns the value of header field from the specified message. This allows an application to be able to easily determine the value of a header such as the sender, or the subject of the message. Any header field, including non-standard extensions, may be returned by this method.

Requirements

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

See Also