View Single Post
  #1  
Old December 30th 08, 10:52 PM posted to microsoft.public.outlook.program_forms
UTEK
external usenet poster
 
Posts: 1
Default Unable to create HTML mail message(Unicode) using MAPI in Outlook

have this chunk of code that creates an email body in outlook . If it is
regular text, it uses the PR_BODY_W property; if it is html format, then it
uses 0x1013001F(PR_BODY_HTML_W).

if (fishtml)
{
SPropValue vals;
SPropProblemArray *lpprob;
memset(&vals, 0, sizeof(SPropValue));
//vals.ulPropTag = PR_STORE_SUPPORT_MASK;
vals.ulPropTag = PR_MSG_STATUS;
vals.Value.l = 0x80000000;
hr = mapiprop-SetProps(1, &vals, &lpprob);
}

hr = mapiprop-OpenProperty((fishtml?0x1013001F:PR_BODY_W), &IID_IStream, 0,
MAPI_MODIFY|MAPI_CREATE, (IUnknown**)&lpistream);

if (SUCCEEDED(hr))
{
ULONG cnt = (::SysStringLen(bsbody)+1) * sizeof(wchar_t);
ULONG cntwritten = 0;
lpistream-Write(bsbody, cnt, &cntwritten);
fsetbody = TRUE;
}


This works perfect in Outlook 2003. However, in Outlook 2007, the HTML mail
message always comes up blank while PR_BODY_W is fine.

I have also tried setting the PR_MSG_STATUS to
0x80000000(MSGSTATUS_HAS_PR_BODY_HTML
) , but it doesn't help. Any suugestions is greatly appreciated! Thank you
very much.
Ads