CMailMessage::GetMessageSize Method  
 
DWORD GetMessageSize(
  DWORD dwOptions  
);

The GetMessageSize method returns the size of the complete message in bytes.

Parameters

dwOptions
An optional unsigned integer value which specifies how the size of the message should be calculated, based on what header fields should be included. These are the same options used when exporting a message to a file or memory buffer. The following values may be combined using a bitwise Or operator:
Value Description
MIME_OPTION_DEFAULT The default export options. The headers for the message are written out in a specific consistent order, with custom headers written to the end of the header block regardless of the order in which they were set or imported from another message. If the message contains Bcc, Received, Return-Path, Status or X400-Received header fields, they will not be exported.
MIME_OPTION_ALLHEADERS All headers, including the Received, Return-Path, Status and X400-Received header fields will be exported. Normally these headers are not exported because they are only used by the mail transport system. This option can be useful when exporting a message to be stored on the local system, but should not be used when exporting a message to be delivered to another user.

Return Value

If the method succeeds, the return value is the size of the current message in bytes. If an error occurs, the method will return MIME_ERROR. To get extended error information, call GetLastError.

Remarks

This method returns the size of the complete message, including all headers, the message body and any attachments. It can be used to determine the minimum amount of memory that should be allocated to export the message to a memory buffer using the ExportMessage method.

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

See Also

ExportMessage, GetText, ImportMessage, SetExportOptions