CPopClient::GetHeaderValue Method  
 
INT GetHeaderValue(
  UINT nMessageId,  
  LPCTSTR lpszHeader,  
  LPTSTR lpszValue,  
  INT nMaxLength  
);
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.
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, the method 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 POP_ERROR. To get extended error information, call GetLastError.

Remarks

The GetHeaderValue method returns the value of a 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) without downloading the entire message header and parsing the contents.

This method uses the XTND XLST command, which is an extension to the POP3 protocol. If this command is not supported by the server, the method will attempt to retrieve the entire message header and return the value for the specified header field. This enables an application to use this method even if the server does not support command extensions.

Requirements

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

See Also

GetMessageHeaders, GetMessageId, GetMessageSender