- #pragma once
- /********************************************************************
- created: 2008:9:26 13:39
- author: 李欣
- filename: c:MyProjectSimpleMailSimpleMailMailManager.h
- classname: CMailManager
- purpose: manage sending and receiving the mail
- *********************************************************************/
- class CMailManager
- {
- public:
- CMailManager(void);
- ~CMailManager(void);
- //////////////////////////////////////////////////////////////////////////
- ///<summary>
- /// send a mail
- ///</summary>
- HRESULT SendMailMessage(IN const CString& strRcs,
- IN const CString& strCCRcs,
- IN const CString& strBCCRcs,
- IN const CString& strSubject,
- IN const CString& strContent,
- IN const CStringArray& strAttachFiles);
- //////////////////////////////////////////////////////////////////////////
- ///<summary>
- /// receive the mails
- ///</summary>
- ///<param name = pProgressDlg>
- /// the pointer to the progress dialog
- ///</param>
- ///</param>
- ///<param name = arrPos>
- /// the position to locate each mail in the file
- ///</param>
- ///<param name = arrSize>
- /// the size of each mail
- ///</param>
- /// <returns>
- /// the value dictating whether it is successful
- /// </returns>
- HRESULT RecMail(IN CRecvProgressDlg* pProgressDlg, OUT CArray<MAILPOS>& arrPos, OUT CArray<UINT>& arrSize);
- ///<summary>
- /// delete the specified mail
- ///</summary>
- ///<param name = arrIndex>
- /// the index of the mail to be deleted
- ///</param>
- /// <returns>
- /// the value dictating whether it is successful
- /// </returns>
- HRESULT DelMail(IN const CArray<UINT>& arrIndex);
- //////////////////////////////////////////////////////////////////////////
- ///<summary>
- /// get the user name
- ///</summary>
- CString GetUserName();
- ///<summary>
- /// set the user name
- ///</summary>
- void SetUserName(IN const CString& strUserName);
- ///<summary>
- /// get the password
- ///</summary>
- CString GetPassword();
- ///<summary>
- /// set the password
- ///</summary>
- void SetPassword(IN const CString& strPassword);
- ///<summary>
- /// get the smtp server address
- ///</summary>
- CString GetSmtpServer();
- ///<summary>
- /// set the smtp server address
- ///</summary>
- void SetSmtpServer(IN const CString& strSmtpServer);
- ///<summary>
- /// get the pop3 server address
- ///</summary>
- CString GetPopServer();
- ///<summary>
- /// set the pop3 server address
- ///</summary>
- void SetPopServer(IN const CString& strPopServer);
- ///<summary>
- /// get the sender address
- ///</summary>
- CString GetSendMail();
- ///<summary>
- /// set the sender address
- ///</summary>
- void SetSendMail(IN const CString& strSendMail);
- ///<summary>
- /// get the setting whether to validate the identity
- ///</summary>
- BOOL GetValidate();
- ///<summary>
- /// set whether to validate the identity
- ///</summary>
- void SetValidate(IN BOOL bValidate);
- ///<summary>
- /// get the manager for saving mails
- ///</summary>
- CMailSaveMngr* GetSaveMngr();
- private:
- ///<summary>
- /// the manager for sending mails
- ///</summary>
- CSmtpSendManger m_cSendMngr;
- ///<summary>
- /// the manager for receive mails
- ///</summary>
- CPopReceiveManager m_cReceiveMngr;
- ///<summary>
- /// the manager for saving mails
- ///</summary>
- CMailSaveMngr m_cSaveMngr;
- ///<summary>
- /// the user name
- ///</summary>
- CString m_strUserName;
- ///<summary>
- /// the password
- ///</summary>
- CString m_strPassword;
- ///<summary>
- /// the smtp server
- ///</summary>
- CString m_strSmtpServer;
- ///<summary>
- /// the pop3 server
- ///</summary>
- CString m_strPopServer;
- ///<summary>
- /// the sender address
- ///</summary>
- CString m_strSendMail;
- ///<summary>
- /// whether the smtp server need validate the identity
- ///</summary>
- BOOL m_bValidate;
- };