different problem

  • Thread starter Thread starter Ram
  • Start date Start date
R

Ram

hi,

i have captured itemsend event. When ever the user click the send
button, i used to add some data at the end of mail. It has been adding. It
showing in the view,but when the mail is sent.it is not with mail.

how can i solve this
 
Here is ther code, which i am written in "itemsend" event .





CComPtr<Outlook::_Application>m_applicant(m_spApp);

CComPtr<Outlook::_Inspector>m_inspect;



HRESULT hr;

IDispatch *Pdisp;

IHTMLDocument2Ptr htmdocument=NULL;

IHTMLElement *htmelement;

BSTR m_bstr;

char ks[20000];

int net_lenght;

hr= m_applicant->ActiveInspector(&m_inspect);

if(FAILED(hr))

MessageBox(NULL,_T("This is not active inspector object"),_T("Current
Inspector"),MB_OK);

/*

else

MessageBox(NULL,_T("This is active inspector object"),_T("Current
Inspector"),MB_OK);

*/

hr=m_inspect->get_HTMLEditor(&Pdisp);


if(FAILED(hr))

MessageBox(NULL,_T("HTML Editor object is not
creating"),_T("Simleys"),MB_OK);

hr=Pdisp->QueryInterface(IID_IHTMLDocument2,(void**)&htmdocument);


if(FAILED(hr)||(htmdocument==NULL))

{

MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);

}

/*

else

MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);

*/



hr=htmdocument->get_body(&htmelement);

if(FAILED(hr))

{

MessageBox(NULL,_T("The htmelement is not intiated"),_T("Smileys"),MB_OK);

}


htmelement->get_innerHTML(&m_bstr);

net_lenght=WideCharToMultiByte(CP_ACP,0,m_bstr,-1,NULL,0,NULL,NULL);

WideCharToMultiByte(CP_ACP,0,m_bstr,-1,ks,net_lenght+1,NULL,NULL);

strcat(ks,"Here is text wiill be added");

net_lenght=sizeof(ks);

MultiByteToWideChar(CP_ACP,NULL,ks,-1,m_bstr,net_lenght+1);

htmdocument->put_designMode(CComBSTR("On"));

hr=htmelement->put_innerHTML(m_bstr);

if(hr==S_OK)


MessageBox(NULL,_T("Here text Added"),_T("Smileys"),MB_OK);

else


MessageBox(NULL,_T("text is not added"),_T("Smileys"),MB_OK);



htmdocument->put_designMode(CComBSTR("Off"));


Plz suggest me any solution
 
Does it work Ok if you set the MailItem.HTMLBody property instead?

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

Ram said:
Here is ther code, which i am written in "itemsend" event .





CComPtr<Outlook::_Application>m_applicant(m_spApp);

CComPtr<Outlook::_Inspector>m_inspect;



HRESULT hr;

IDispatch *Pdisp;

IHTMLDocument2Ptr htmdocument=NULL;

IHTMLElement *htmelement;

BSTR m_bstr;

char ks[20000];

int net_lenght;

hr= m_applicant->ActiveInspector(&m_inspect);

if(FAILED(hr))

MessageBox(NULL,_T("This is not active inspector object"),_T("Current
Inspector"),MB_OK);

/*

else

MessageBox(NULL,_T("This is active inspector object"),_T("Current
Inspector"),MB_OK);

*/

hr=m_inspect->get_HTMLEditor(&Pdisp);


if(FAILED(hr))

MessageBox(NULL,_T("HTML Editor object is not
creating"),_T("Simleys"),MB_OK);

hr=Pdisp->QueryInterface(IID_IHTMLDocument2,(void**)&htmdocument);


if(FAILED(hr)||(htmdocument==NULL))

{

MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);

}

/*

else

MessageBox(NULL,_T("IHTMLDocument Object is not
creating"),_T("Smileys"),MB_OK);

*/



hr=htmdocument->get_body(&htmelement);

if(FAILED(hr))

{

MessageBox(NULL,_T("The htmelement is not intiated"),_T("Smileys"),MB_OK);

}


htmelement->get_innerHTML(&m_bstr);

net_lenght=WideCharToMultiByte(CP_ACP,0,m_bstr,-1,NULL,0,NULL,NULL);

WideCharToMultiByte(CP_ACP,0,m_bstr,-1,ks,net_lenght+1,NULL,NULL);

strcat(ks,"Here is text wiill be added");

net_lenght=sizeof(ks);

MultiByteToWideChar(CP_ACP,NULL,ks,-1,m_bstr,net_lenght+1);

htmdocument->put_designMode(CComBSTR("On"));

hr=htmelement->put_innerHTML(m_bstr);

if(hr==S_OK)


MessageBox(NULL,_T("Here text Added"),_T("Smileys"),MB_OK);

else


MessageBox(NULL,_T("text is not added"),_T("Smileys"),MB_OK);



htmdocument->put_designMode(CComBSTR("Off"));


Plz suggest me any solution



--
Regards,

RamakoteswaraRao Koti

Dmitry Streblechenko said:
Please show the relevant snippets of your code.

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