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 mail functions.
39 // Copyright (c) 2003 Michael Carruth
41 ///////////////////////////////////////////////////////////////////////////////
48 typedef std::map
<std::string
, std::string
> TStrStrMap
;
50 // ===========================================================================
53 // See the module comment at top of file.
58 // Construction/destruction
63 void SetTo(CString sAddress
);
64 void SetFrom(CString sAddress
);
65 void SetSubject(CString sSubject
);
66 void SetMessage(CString sMessage
);
67 void AddAttachment(CString sAttachment
, CString sTitle
= _T(""));
68 void AddCC(CString sAddress
);
69 void SetShowComposeDialog(BOOL showComposeDialog
);
71 BOOL
MAPIInitialize();
74 static BOOL
DetectMailClient(CString
& sMailClientName
);
75 CString
GetEmailClientName();
77 CString
GetLastErrorMsg(){ return m_sErrorMsg
; }
80 std::string m_from
; // From <address,name>
81 std::string m_to
; // To <address,name>
82 TStrStrMap m_attachments
; // Attachment <file,title>
83 std::vector
<std::string
> m_cc
; // CC receipients
84 std::string m_sSubject
; // EMail subject
85 std::string m_sMessage
; // EMail message
87 HMODULE m_hMapi
; // Handle to MAPI32.DLL
88 LPMAPISENDMAIL m_lpMapiSendMail
; // Mapi func pointer
90 BOOL m_bReady
; // MAPI is loaded
91 BOOL m_bShowComposeDialog
;
92 CString m_sEmailClientName
;