MimeGetFirstMessageHeader Function  
 
BOOL WINAPI MimeGetFirstMessageHeader(
  HMESSAGE hMessage,  
  LPTSTR lpszHeader,  
  INT cchMaxHeader,  
  LPTSTR lpszValue,  
  INT cchMaxValue  
);

The MimeGetFirstMessageHeader function returns the header field name and value for the first header in the current message part. This function is typically used in conjunction with MimeGetNextMessageHeader to enumerate all of the message header fields and their values in the current message part.

Parameters

hMessage
Handle to the message.
lpszHeader
Pointer to the buffer which will contain a null-terminated string that specifies the name of the first header in the current message part. This parameter cannot be a NULL pointer.
cchMaxHeader
An integer which specifies the maximum number of characters which may be copied into the buffer, including the terminating null character. This parameter must have a value greater than zero.
lpszValue
Pointer to the buffer which will contain a null-terminated string that specifies the value of the first header in the current message part. This parameter may be a NULL pointer, in which case the value of the header field is ignored.
cchMaxValue
An integer which specifies the maximum number of characters which may be copied into the buffer, including the terminating null character. If the lpszValue parameter is NULL, this parameter should have a value of zero.

Return Value

If the function succeeds, the return value is non-zero. If no headers exist for the current message part, or the handle to the message is invalid, the function will return zero. To get extended error information, call MimeGetLastError.

Remarks

Each part in a multipart message has one or more header fields. To obtain header values for the main message, rather than the message attachments, the current part number must be set to zero using the MimeSetMessagePart function.

The header fields from an imported message may not be returned in the same order as which they appear in the message. An application should never make an assumption about the order in which one or more header fields are defined.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmsgav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

MimeEnumMessageHeaders, MimeGetMessagePart, MimeGetNextMessageHeader, MimeParseHeader, MimeSetMessageHeader, MimeSetMessagePart