Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++, Enterprise
Expertise: Beginner
Aug 19, 2002

Send Mail Using a VC++ Application


Import the complete path of the following files in your application using the #import statement:
  1. MSO9.DLL
  2. msoutl9.olb
  3.  
    HRESULT hr;
    CComBSTR inputStr;
    inputStr = CString("MAPI").GetBuffer(0);
    CoInitialize(NULL);
    
    Outlook::_ApplicationPtr xyz(
    "Outlook.Application");
    _bstr_t name(inputStr, true);
    Outlook::_NameSpacePtr nsp = xyz->GetNamespace(name);
    
    CComBSTR cTo = CString("support@devx.com").GetBuffer(0);
    
    CComBSTR cCC = CString("support@devx.com").GetBuffer(0);
    
    CComBSTR cBody = CString("this is a test mail").GetBuffer(0);
    
    CComBSTR cSub = CString("this is a test mail").GetBuffer(0);
    
    _bstr_t to(cTo, true);
    _bstr_t cc(cCC, true);
    _bstr_t body(cBody, true);
    _bstr_t sub(cSub, true);
    
    Outlook::_MailItemPtr miPtr = xyz->CreateItem(
    Outlook::olMailItem);
    
    miPtr->put_To(to);
    miPtr->put_CC(cc);
    miPtr->put_Body(body);
    miPtr->put_Subject(sub);
    
    hr = miPtr->Send();
    
Amit Vij
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap