empty body in sent item vc++ (outlook 2000)

K

kireetgajera

Hi... All

I am using VC++ 6.0,

I use following code to send .msg file, but when sent, mail in sent
item shows empty body part, but it works fine in outlook 2003.

My Code :

CoInitialize(NULL);
HRESULT hr;


_ApplicationPtr pOutlook = NULL;
IOutlookSecurityManagerPtr spOSM = NULL;
_MailItemPtr pMailItem = NULL;


try
{
hr = pOutlook.CreateInstance("Outlook.Application");
if(FAILED(hr))
throw hr;


_bstr_t bstrPath(strPath);

pMailItem = pOutlook->CreateItemFromTemplate(bstrPath);

if(strTo.IsEmpty()==FALSE)
{
bstr_t bstrTo(strTo);
hr = pMailItem->put_To(bstrTo);
if(FAILED(hr))
throw hr;
}

BSTR bs;
pMailItem->get_Body(&bs);
_bstr_t b(bs,FALSE);
AfxMessageBox(b);

if
(FAILED(spOSM.CreateInstance("AddInExpress.OutlookSecurityManager")))
{
//::MessageBox(NULL,"An error occurred creating an instance of
Security Manager!","Digital Rights Solutions",MB_OK);
throw hr;
}

_variant_t OutlookApp = (_variant_t)pOutlook.GetInterfacePtr();

hr = spOSM->ConnectTo(OutlookApp);
if(FAILED(hr))
throw hr;

spOSM->PutDisableOOMWarnings(_variant_t(true));

hr = pMailItem->raw_Send();
if (FAILED(hr))
throw hr;

spOSM->PutDisableOOMWarnings(_variant_t(false));

}
catch(...)
{
if(spOSM != NULL)
{
spOSM.Release();
spOSM = NULL;
}

if(pOutlook != NULL)
{
pOutlook.Release();
pOutlook = NULL;
}

if(pMailItem != NULL)
{
pMailItem.Release();
pMailItem = NULL;
}

::CoUninitialize();

return FALSE;
}


spOSM.Release();
spOSM = NULL;


pOutlook.Release();
pOutlook = NULL;


pMailItem.Release();
pMailItem = NULL;

::CoUninitialize();

return TRUE;

======================

but when i connect my outlook 2000 with Exchange server, it works fine,
but when cofigured to POP3 account creates empty body part.

Plz help me out..........

Thanks in advance..

Kireet Gajera
 

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