Problem reading PR_BODY in Outlook 2003

H

habanero_2001

I have used Extended MAPI to read a Message Body (plain text)
succcessfully in Microsoft Outlook 2000 and 2002 using C++ Builder:

char *bodybuf=0;
unsigned int bodysize=0;
IStream *istream;
hr = imsg->OpenProperty(PR_BODY, &IID_IStream, STGM_READ, 0,
(IUnknown**)&istream);
if (hr==S_OK)
{
STATSTG stg = {0};
hr = istream->Stat(&stg,STATFLAG_NONAME);
if (hr==S_OK)
{
bodysize = stg.cbSize.LowPart;
bodybuf = new char[bodysize+1];
ULONG red;
hr = istream->Read(bodybuf, bodysize, &red);
if (hr!=S_OK)
bodysize=0;
else if (red<bodysize)
bodysize=red;
bodybuf[bodysize]=0;
}
istream->Release();
}

But the problem happens when I read a message in Microsoft Outlook
2003: body lines are wrapped at no more than 70 characters per line
with phisical \r\n which are not present in the message body if I open
the message and copy its body and paste it in the notepad. I read the
same message in Outlook 2002 and the plain text is correct, without
these extra \r\n. I guess it could be a parameter to get the message's
plain text without any wrap.

I have tried reading PR_BODY_HTML and it does not contain the \r\n but
I am interested in the plain text, and I wouldn't like to remove all
HTML tags.

Any idea?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top