Click here to Skip to main content
15,891,902 members
Articles / Desktop Programming / MFC

The Ultimate Toolbox Home Page

Rate me:
Please Sign up or sign in to vote.
4.97/5 (141 votes)
25 Aug 2007CPOL13 min read 3.2M   91.4K   476  
The Ultimate Toolbox is now Open Source
#ifndef __MAILENGINE_H_
#define __MAILENGINE_H_

#include "OXThreadEngine.h"
#include "OXSendMail.h"
#include "MailCmd.h"

#define MR_MMERR_SUCCESS	0x0000
#define MR_MMERR_LOGON		0x0101
#define MR_MMERR_RECIPIENT	0x0102
#define MR_MMERR_SENT		0x0103
#define MR_MMERR_HOMEID		0x0104


class CMailEngine : public COXThreadEngine
{
// Data Members
public:

protected:
	COXSendMail		m_sendMail;

private:
	static short	defError;

// Member Functions
public:
	CMailEngine();
	virtual ~CMailEngine();

	BOOL LogOn(CString sProfile, CString sPassword);
	void LogOff();
	BOOL IsLoggedOn();
	BOOL Send(CString sMAPIProfile,
			  CString sMAPIPassword,
			  CString sRecipient, 
			  CString sSubject, 
			  CString sContent,
			  const CStringArray& sAttachments,
			  short& nError = defError);


protected:
	virtual void OnExecuteCmd(COXEngineCmd* pCmd);
	virtual void OnThreadDestruction();

	void OnLogOn(CMCLogOn& cmd);
	void OnLogOff(CMCLogOff& cmd);
	void OnSend(CMCSend& cmd);


private:

};

extern CMailEngine theMailEngine;

#endif // __MAILENGINE_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

Comments and Discussions