Parameters
None.
Return Value
This method returns the number of text characters in the current
message part. If the current message part does not contain any text,
the method will return zero. If the method fails it will return
MIME_ERROR. To retrieve extended error information, call the
GetLastError method.
Remarks
The GetTextLength method returns the actual length of the message text
in the current message part. This value may be different than what is
returned by the GetContentLength method, which returns the value of
the content length in bytes, as specified in the message header. The
GetTextLength method returns the number of
characters (not bytes) in the message text after the contents have
been decoded and converted to Unicode.
Example
if (mailMessage.GetContentType(hMessage) == MIME_CONTENT_TEXT)
{
LONG cchMessage = mailMessage.GetTextLength();
if (cchMessage < 1)
{
_tprintf(_T("Message part %d does not contain any text\n"), nMessagePart);
return;
}
LPTSTR pszMessage = (LPTSTR)malloc((cchMessage + 1) * sizeof(TCHAR));
if (pszMessage == NULL) // Virtual memory exhausted
return;
cchMessage = mailMessage.GetText(pszMessage, cchMessage + 1);
if (cchMessage > 0)
{
fwrite(pszMessage, sizeof(TCHAR), cchMessage, stdout);
fflush(stdout);
}
free(pszMessage);
}
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
|