K
kireetgajera
HI.. All
I am using VC++ 6.0.
I user Outlook Object to load a .msg file and send it. (code at last of
msg).
It works fine in Outlook 2000 and 2003, but creates problem in Outlook
2002. After sending mail the mail in SentItems folder having empty
body, but the actual recipient gets exact body as was sent by sender.
So, is there any problem in My Outlook settings or something wrong with
my code..
But, another machine woth Outlook 2002, connected to Exchange server
works fine, but in my machine which is connected to my POP3 acoount
creating problem :
My code :
=================================================================
CoInitialize(NULL);
HRESULT hr;
_ApplicationPtr pOutlook = 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;
}
hr = pMailItem->raw_Send();
if (FAILED(hr))
throw hr;
}
catch(...)
{
if(pOutlook != NULL)
{
pOutlook.Release();
pOutlook = NULL;
}
if(pMailItem != NULL)
{
pMailItem.Release();
pMailItem = NULL;
}
if(p != NULL)
{
p.Release();
p = NULL;
}
::CoUninitialize();
return FALSE;
}
pOutlook.Release();
pOutlook = NULL;
pMailItem.Release();
pMailItem = NULL;
p.Release();
p = NULL;
::CoUninitialize();
return TRUE;
=================================================================
Thanks in advance..
kireet gajera
I am using VC++ 6.0.
I user Outlook Object to load a .msg file and send it. (code at last of
msg).
It works fine in Outlook 2000 and 2003, but creates problem in Outlook
2002. After sending mail the mail in SentItems folder having empty
body, but the actual recipient gets exact body as was sent by sender.
So, is there any problem in My Outlook settings or something wrong with
my code..
But, another machine woth Outlook 2002, connected to Exchange server
works fine, but in my machine which is connected to my POP3 acoount
creating problem :
My code :
=================================================================
CoInitialize(NULL);
HRESULT hr;
_ApplicationPtr pOutlook = 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;
}
hr = pMailItem->raw_Send();
if (FAILED(hr))
throw hr;
}
catch(...)
{
if(pOutlook != NULL)
{
pOutlook.Release();
pOutlook = NULL;
}
if(pMailItem != NULL)
{
pMailItem.Release();
pMailItem = NULL;
}
if(p != NULL)
{
p.Release();
p = NULL;
}
::CoUninitialize();
return FALSE;
}
pOutlook.Release();
pOutlook = NULL;
pMailItem.Release();
pMailItem = NULL;
p.Release();
p = NULL;
::CoUninitialize();
return TRUE;
=================================================================
Thanks in advance..
kireet gajera