PTLib  Version 2.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mail.h
Go to the documentation of this file.
1 /*
2  * mail.h
3  *
4  * Electronic Mail abstraction class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 24461 $
30  * $Author: shorne $
31  * $Date: 2010-06-06 09:06:37 -0500 (Sun, 06 Jun 2010) $
32  */
33 
34 #ifndef PTLIB_MAIL_H
35 #define PTLIB_MAIL_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 #if defined(_WIN32) && !defined(_WIN64)
42 
43 # ifndef P_HAS_MAPI
44 # define P_HAS_MAPI 1
45 # endif
46 
47 # ifndef P_HAS_CMC
48 # define P_HAS_CMC 1
49 # endif
50 
51 # if P_HAS_MAPI
52 # include <mapi.h>
53 # endif
54 
55 # if P_HAS_CMC
56 # include <xcmc.h>
57 # endif
58 
59 #endif // _WIN32
60 
61 
64 class PMail : public PObject
65 {
66  PCLASSINFO(PMail, PObject);
67 
68  public:
73  PMail();
74 
78  PMail(
79  const PString & username,
80  const PString & password
81  );
82 
86  PMail(
87  const PString & username,
88  const PString & password,
89  const PString & service
94  );
95 
96 
97  virtual ~PMail();
98  /* Destroy the mail session, logging off the mail system if necessary.
99  */
101 
109  PBoolean LogOn(
110  const PString & username,
111  const PString & password
112  );
113 
119  PBoolean LogOn(
120  const PString & username,
121  const PString & password,
122  const PString & service
127  );
128 
134  virtual PBoolean LogOff();
135 
141  PBoolean IsLoggedOn() const;
143 
153  const PString & recipient,
154  const PString & subject,
155  const char * body
156  );
157 
165  const PString & recipient,
166  const PString & subject,
167  const char * body,
168  const PStringList & attachments
170  );
171 
179  const PString & recipient,
180  const PStringList & carbonCopies,
181  const PStringList & blindCarbons,
182  const PString & subject,
183  const char * body,
184  const PStringList & attachments
186  );
188 
197  PBoolean unreadOnly = true
198  );
199 
201  struct Header {
210  };
211 
218  const PString & id,
219  Header & hdrInfo
220  );
221 
239  const PString & id,
240  PString & body,
241  PBoolean markAsRead = false
242  );
243 
250  const PString & id,
251  PStringArray & filenames,
252  PBoolean includeBody = false,
253  PBoolean markAsRead = false
254  );
255 
262  const PString & id
263  );
264 
271  const PString & id
272  );
274 
277 
287  };
288 
296  const PString & name,
297  PString * fullName = NULL
301  );
303 
312  int GetErrorCode() const;
313 
320  PString GetErrorText() const;
322 
323 
324  protected:
325  void Construct();
326  // Common construction code.
327 
330 
331 
332 // Include platform dependent part of class
333 #ifdef _WIN32
334 #include "msos/ptlib/mail.h"
335 #else
336 #include "unix/ptlib/mail.h"
337 #endif
338 };
339 
340 
341 #endif // PTLIB_MAIL_H
342 
343 
344 // End Of File ///////////////////////////////////////////////////////////////