CMailMessage::GetContentLength Method  
 
LONG GetContentLength();

The GetContentLength method returns the size of the current message part content in bytes.

Parameters

None.

Return Value

If the method succeeds, the return value is the content length. If the method fails, the return value is MIME_ERROR. To get extended error information, call GetLastError.

Remarks

This function will return the size of the content in the current message part as the number of bytes and does not account for any Unicode conversion of text. Exercise caution when using this function to determine the size of the buffer that should be allocated for a method like GetText. You should always allocate enough memory to accommodate any potential text conversion and decoding which may occur.

If you need to know the actual length of the decoded text in the current message part, use the GetTextLength method. That method will return the number of characters (not bytes) in the message after they have been decoded and the text has been converted to Unicode.

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

See Also