CCMC v1.04

Welcome to CCMC, 2 simple classes to encapsulate sending mail using the Common Messaging Calls (CMC) interface.

CMC is a platform independent API which provides messaging capabilities similar to simple MAPI on Windows. Other obvious API's of use to the MFC programmer are SMTP and Simple MAPI. The author has provided freeware classes for these at http://www.naughter.com/smtp.html and http://www.naughter.com/cmapi.html respectively. This class has been exclusively tested with the MS reference implementation of CMC but should work ok with any other CMC implementation on Windows.

 

Features
Copyright
Usage
History
API Reference
Planned Enhancements
Contacting the Author

 

 

 

Features

 

 

 

Copyright

 

 

 

Usage

 

 

 

History

V1.0 (25th November 1999)

V1.01 (28 March 2000)

V1.02 (2 April 2000)

V1.03 (22 December 2006)

V1.04 (1 January 2007)

 

 

 

API Reference

The API consists of the following 2 classes and their methods and variables

 

CCMCMessage

CCMCMessage::m_To
CCMCMessage::m_CC
CCMCMessage::m_BCC
CCMCMessage::m_sSubject
CCMCMessage::m_sBody
CCMCMessage::m_Attachments
CCMCMessage::m_AttachmentTitles

 

CCMCSession

CCMCSession::CCMCSession
CCMCSession::~CCMCSession
CCMCSession::Logon
CCMCSession::LoggedOn
CCMCSession::Logoff
CCMCSession::Send
CCMCSession::CMCInstalled
CCMCSession::GetLastError

 

 

CCMCMessage::m_To

Remarks

m_To is of type CStringArray and contains the array of recipients which the email is to be mailed to.

 

CCMCMessage::m_CC

Remarks

m_CC is of type CStringArray and contains the array of recipients which the email will be Carbon Copied to.

 

CCMCMessage::m_BCC

Remarks

m_BCC is of type CStringArray and contains the array of recipients which the email will be Blind Carbon Copied to.

 

CCMCMessage::m_sSubject

Remarks

m_sSubject is of type CString and is the subject line of the email.

 

CCMCMessage::m_sBody

Remarks

m_sBody is of type CString and is the body of the email.

 

CCMCMessage::m_Attachments

Remarks

m_Attachments is of type CStringArray and is a list of filenames to be included as attachments in the email.

 

CCMCMessage::m_AttachmentTitles

Remarks

m_AttachmentTitles is of type CStringArray and contains the titles of what each file attachment will be known as to recipients of this message. If you leave this array empty then the title will be the same as the filename.

 

 

CCMCSession::CCMCSession

CCMCSession();

Remarks

Standard constructor for the class. This class is the main CMC support class and contains the functions to actually send the mail message.

 

CCMCSession::~CCMCSession

~CCMCSession();

Remarks

Standard destructor for the class. Internally this logs you out of CMC if you're logged in and unloads the CMC dll.

 

CCMCSession::Logon

BOOL Logon(const CString& sProfileName, const CString& sPassword = CString(), CWnd* pParentWnd = NULL);

Return Value

TRUE if you were successfully logged in to CMC otherwise FALSE

Parameters

sProfileName CMC profile name to use to logon.

sPassword Password associated with the profile (if any).

pParentWnd The parent window indicating that if a dialog box is displayed, it is modal with respect to.

Remarks

Logons to the CMC messaging system creating a session with it. If you pass an empty profile name then Logon will try to interactively logon by presenting the normal CMC logon dialog. Specifying NULL as the parent window as is the default will use the window as returned by AfxGetMainWnd(). Please note that you must be logged on to CMC prior to sending a message. Internally the code will "ASSERT" to ensure you do not forget to do this.

 

CCMCSession::LoggedOn

BOOL LoggedOn() const;

Remarks

Simply accessor which returns TRUE if this instance is logged on to CMC otherwise FALSE.

 

CCMCSession::Logoff

BOOL Logon();

Return Value

TRUE if you were successfully logged off from CMC otherwise FALSE

Remarks

The corollary function to Logon. Internally this function is called in the CCMCSession destructor.

 

CCMCSession::Send

BOOL Send(CCMCMessage& message, BOOL bInteractive = FALSE, CWnd* pParentWnd = NULL);

Return Value

TRUE if the message was successfully sent otherwise FALSE.

Parameters

message Message to be sent

bInteractive TRUE if you want the message to be editable by the end user prior to the message actually being sent.

pParentWnd If bInteractive is TRUE, then this is the parent window to use. If it is left as NULL, then the window as returned by AfxGetMainWnd() will be used.

Remarks

Sends the message as specified in the "message" parameter, using the CMC profile currently logged into.

 

CCMCSession::CMCInstalled

BOOL CMCInstalled() const;

Remarks

Simply accessor which returns TRUE if CMC is installed and has been correctly initialized ready for this instance to use. The actual loading of the CMC dll is handled internally by the CCMCSession constructor, meaning it is valid to call this function anytime after you have constructed a CCMCSession instance.

 

CCMCSession::GetLastError

CMC_return_code GetLastError() const;

Return Value

The last CMC error generated by this CCMCSession instance.

Remarks

Since the class uses CMC which has its own way of reporting errors different to the standard Win32 way (GetLastError), this method allows this value to be retrieved. CMC errors are documented in the xcmc.h file in your VC include directory.

 

 

 

Planned Enhancements

 

 

 

Contacting the Author

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
1 January 2007