CMailMessage::GetAllHeaders Method  
 
INT GetAllHeaders(
  LPTSTR lpszHeaders,  
  INT nMaxLength  
);
INT GetAllHeaders(
  CString& strHeaders  
);

The GetAllHeaders method returns the complete RFC 822 header values in a string buffer.

Parameters

lpszHeaders
Pointer to string buffer which will contain the header values for the current message. This parameter may be NULL, in which case the method will calculate the number of characters needed to store the complete header block.
nMaxLength
An integer value which specifies the maximum number of characters that can be stored in the lpszHeaders string. If the lpszHeaders parameter is NULL, this value must be zero. If the lpszHeaders parameter is not NULL, this value must be large enough to store the entire list of addresses.
strHeaders
A CString object that will contain the header values for the current message. This version of the method is available if MFC or ATL is being used by the application, and the memory required to store the complete header block will be calculated automatically.

Return Value

If the method succeeds and the lpszHeaders parameter is NULL, the return value is the minimum number of characters that should be allocated to store all of the header values, including the terminating null character. If the lpszHeaders parameter is not NULL, then the return value is the number of characters copied into the string, not including the terminating null character. If the method fails, the return value is MIME_ERROR. To get extended error information, call GetLastError.

Remarks

The GetAllHeaders method will return all of the RFC 822 header values in a string buffer. This includes the message headers that are most commonly referred to, such as the To, From and Subject headers. Each header and its value are separated by a colon, and terminated with a carriage return and linefeed (CRLF) pair.

The headers and their values returned by this method will not be identical to the header block in the original message. If a header value is split across multiple lines, this method will fold the text, returning the complete header value on a single line of text and removing any extraneous whitespace. If the header value has been encoded by the mail client, this method will return the decoded value, not the original encoded value.

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: csmsgv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also