1 /*************************************************************************************
2 This file is a part of CrashRpt library.
4 Copyright (c) 2003, Michael Carruth
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
10 * Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
17 * Neither the name of the author nor the names of its contributors
18 may be used to endorse or promote products derived from this software without
19 specific prior written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ***************************************************************************************/
33 ///////////////////////////////////////////////////////////////////////////////
37 // Desc: This class encapsulates the MAPI and CMC mail functions.
39 // Copyright (c) 2003 Michael Carruth
41 ///////////////////////////////////////////////////////////////////////////////
48 typedef std::map
<std::string
, std::string
> TStrStrMap
;
51 // Define CMC entry points
53 typedef CMC_return_code (FAR PASCAL
*LPCMCLOGON
) \
54 (CMC_string
, CMC_string
, CMC_string
, CMC_object_identifier
, \
55 CMC_ui_id
, CMC_uint16
, CMC_flags
, CMC_session_id FAR
*, \
58 typedef CMC_return_code (FAR PASCAL
*LPCMCSEND
) \
59 (CMC_session_id
, CMC_message FAR
*, CMC_flags
, \
60 CMC_ui_id
, CMC_extension FAR
*);
62 typedef CMC_return_code (FAR PASCAL
*LPCMCLOGOFF
) \
63 (CMC_session_id
, CMC_ui_id
, CMC_flags
, CMC_extension FAR
*);
65 typedef CMC_return_code (FAR PASCAL
*LPCMCQUERY
) \
66 (CMC_session_id
, CMC_enum
, CMC_buffer
, CMC_extension FAR
*);
69 ////////////////////////////// Class Definitions /////////////////////////////
71 // ===========================================================================
74 // See the module comment at top of file.
79 // Construction/destruction
84 void SetTo(CString sAddress
);
85 void SetFrom(CString sAddress
);
86 void SetSubject(CString sSubject
);
87 void SetMessage(CString sMessage
);
88 void AddAttachment(CString sAttachment
, CString sTitle
= _T(""));
89 void AddCC(CString sAddress
);
90 void SetShowComposeDialog(BOOL showComposeDialog
);
92 BOOL
MAPIInitialize();
95 static BOOL
DetectMailClient(CString
& sMailClientName
);
96 CString
GetEmailClientName();
100 CString
GetLastErrorMsg(){ return m_sErrorMsg
; }
103 std::string m_from
; // From <address,name>
104 std::string m_to
; // To <address,name>
105 TStrStrMap m_attachments
; // Attachment <file,title>
106 std::vector
<std::string
> m_cc
; // CC receipients
107 std::string m_sSubject
; // EMail subject
108 std::string m_sMessage
; // EMail message
110 HMODULE m_hMapi
; // Handle to MAPI32.DLL
111 LPCMCQUERY m_lpCmcQueryConfiguration
; // Cmc func pointer
112 LPCMCLOGON m_lpCmcLogon
; // Cmc func pointer
113 LPCMCSEND m_lpCmcSend
; // Cmc func pointer
114 LPCMCLOGOFF m_lpCmcLogoff
; // Cmc func pointer
115 LPMAPISENDMAIL m_lpMapiSendMail
; // Mapi func pointer
117 BOOL m_bReady
; // MAPI is loaded
118 BOOL m_bShowComposeDialog
;
119 CString m_sEmailClientName
;
124 #endif // _MAILMSG_H_