dcsimg
Login | Register   
LinkedIn
Google+
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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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
Thanks for your registration, follow us on our social networks to keep up-to-date