devxlogo

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("[email protected]").GetBuffer(0);CComBSTR cCC = CString("[email protected]").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();

    Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

    See also  How Engineering Leaders Spot Weak Proposals

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.