Unable to create HTML mail message(Unicode) using MAPI in Outlook

  • Thread starter Thread starter UTEK
  • Start date Start date
U

UTEK

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.
 
Does the message in question actually the HTML body? What do you see in
MFCMAPI or OutlookSpy?
What error code does OpenProperty() return?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Back
Top