www.pudn.com > CCmc_src.zip > app.cpp
#include "stdafx.h"
#include "app.h"
#include "ccmc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
BEGIN_MESSAGE_MAP(CApp, CWinApp)
//{{AFX_MSG_MAP(CApp)
END_MESSAGE_MAP()
CApp::CApp()
{
}
CApp theApp;
BOOL CApp::InitInstance()
{
//Setup a demo message with some parameters, Some of these recipients may not be reachable
//depending on your profile settings.
CCMCMessage message;
message.m_To.Add(_T("pjn@indigo.ie"));
message.m_CC.Add(_T("pjnaughter@hotmail.com"));
message.m_BCC.Add(_T("pj.naughter@softech-telecom.com"));
message.m_sSubject = _T("Demo email using CCMCSession - Please ignore");
message.m_sBody = _T("This is the body of the message\r\nRegards,\r\nCCMCMessage");
message.m_Attachments.Add(_T("C:\\autoexec.bat"));
message.m_AttachmentTitles.Add(_T("my autoexec.bat"));
//Setup the mapi session
CCMCSession session;
BOOL bCMCInstalled = session.CMCInstalled();
//Logon to CMC
BOOL bLoggedOn = session.Logon(_T("PJ Naughter")); //You will need to change this to use a profile
//setup on your computer. If you want CCMCSession to
//bring up a dialog to allow a CMC profile to be
//interactively chosen, then you will need to create
//a Window in your app using the normal MFC mechanisms
ASSERT(bLoggedOn);
//Send the message
BOOL bSent = session.Send(message);
return FALSE;
}