*.js files: keep the style consistent
[TortoiseGit.git] / src / Utils / MailMsg.h
blob1d6e3c1f92d542a3776b813d4ffc0290f6cfd700
1 /*************************************************************************************
2 This file is a part of CrashRpt library.
4 Copyright (c) 2003, Michael Carruth
5 All rights reserved.
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 ///////////////////////////////////////////////////////////////////////////////
35 // Module: MailMsg.h
37 // Desc: This class encapsulates the MAPI mail functions.
39 // Copyright (c) 2003 Michael Carruth
41 ///////////////////////////////////////////////////////////////////////////////
43 #ifndef _MAILMSG_H_
44 #define _MAILMSG_H_
46 #include "stdafx.h"
48 typedef std::map<std::string, std::string> TStrStrMap;
50 // ===========================================================================
51 // CMailMsg
52 //
53 // See the module comment at top of file.
55 class CMailMsg
57 public:
58 // Construction/destruction
59 CMailMsg();
60 virtual ~CMailMsg();
62 // Operations
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();
72 void MAPIFinalize();
74 static BOOL DetectMailClient(CString& sMailClientName);
75 CString GetEmailClientName();
76 BOOL Send();
77 CString GetLastErrorMsg(){ return m_sErrorMsg; }
79 protected:
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;
94 CString m_sErrorMsg;
97 #endif // _MAILMSG_H_