1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SIMPLEMAPI_HXX
25 #define INCLUDED_SIMPLEMAPI_HXX
26 
27 #define WIN32_LEAN_AND_MEAN
28 #if defined _MSC_VER
29 #pragma warning(push, 1)
30 #endif
31 #include <windows.h>
32 #include <mapi.h>
33 #ifndef __MINGW32__
34 #include <mapix.h>
35 #endif
36 #if defined _MSC_VER
37 #pragma warning(pop)
38 #endif
39 
40 class CSimpleMapi
41 {
42 public:
43     /**
44         @throws std::runtime_error
45         if either the mapi32.dll could not be loaded at all
46         or necessary function exports are missing
47     */
48     CSimpleMapi(); // throws std::runtime_error;
49 
50     ~CSimpleMapi();
51 
52     ULONG MAPILogon(
53         ULONG ulUIParam,
54         LPTSTR lpszProfileName,
55         LPTSTR lpszPassword,
56         FLAGS flFlags,
57         ULONG ulReserved,
58         LPLHANDLE lplhSession );
59 
60     ULONG MAPILogoff(
61         LHANDLE lhSession,
62         ULONG ulUIParam,
63         FLAGS flFlags,
64         ULONG ulReserved );
65 
66     ULONG MAPISendMail(
67         LHANDLE lhSession,
68         ULONG ulUIParam,
69         lpMapiMessage lpMessage,
70         FLAGS flFlags,
71         ULONG ulReserved );
72 
73 private:
74     HMODULE         m_hMapiDll;
75     LPMAPILOGON     m_lpfnMapiLogon;
76     LPMAPILOGOFF    m_lpfnMapiLogoff;
77     LPMAPISENDMAIL  m_lpfnMapiSendMail;
78 };
79 
80 #endif
81