Hello Richard,
This is my code. When my outlook email is configured with IMAP setting. (imap.gmail.com and stmp.gmail.com ). At that time ,bstrBody get retrieve with NULL. But (HRESULT)hr value as S_OK. So I am not getting where the problem arise. Same thing happened for put_mail() function.
void CAdIn::OnNewItemSEH(IDispatch * item)
{
CComQIPtr<Outlook::_MailItem> spNewMailitem(item);
if (!spNewMailitem)
{
return;
}
BSTR bstrBody ;
OlBodyFormat bodyFormat;
pMail->get_BodyFormat(&bodyFormat);
if (bodyFormat == olFormatHTML)
{
hr = pMail->get_HTMLBody(&bstrBody);
}
else
{
hr = pMail->get_Body(&bstrBody);
}
if (SUCCEEDED(hr))
{
return CString(bstrBody);
}
else
{
_com_error err(hr);
}