Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

mail.h

Go to the documentation of this file.
00001 /* 00002 * mail.h 00003 * 00004 * Electronic Mail abstraction class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: mail.h,v $ 00030 * Revision 1.13 2003/09/17 05:41:58 csoutheren 00031 * Removed recursive includes 00032 * 00033 * Revision 1.12 2003/09/17 01:18:02 csoutheren 00034 * Removed recursive include file system and removed all references 00035 * to deprecated coooperative threading support 00036 * 00037 * Revision 1.11 2002/09/16 01:08:59 robertj 00038 * Added #define so can select if #pragma interface/implementation is used on 00039 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00040 * 00041 * Revision 1.10 2001/05/22 12:49:32 robertj 00042 * Did some seriously wierd rewrite of platform headers to eliminate the 00043 * stupid GNU compiler warning about braces not matching. 00044 * 00045 * Revision 1.9 1999/03/09 02:59:50 robertj 00046 * Changed comments to doc++ compatible documentation. 00047 * 00048 * Revision 1.8 1999/02/16 08:12:00 robertj 00049 * MSVC 6.0 compatibility changes. 00050 * 00051 * Revision 1.7 1999/02/10 13:20:53 robertj 00052 * Added ability to have attachments in mail messages. 00053 * 00054 * Revision 1.6 1998/09/23 06:20:51 robertj 00055 * Added open source copyright license. 00056 * 00057 * Revision 1.5 1997/05/16 12:14:08 robertj 00058 * Added BCC capability to send mail. 00059 * 00060 * Revision 1.4 1995/07/02 01:19:46 robertj 00061 * Change GetMessageBidy to return BOOL and have body string as 00062 * parameter, due to slight change in semantics for large bodies. 00063 * 00064 * Revision 1.3 1995/06/17 00:42:22 robertj 00065 * Added mail reading interface. 00066 * Changed name to simply PMail 00067 * 00068 * Revision 1.2 1995/04/01 08:27:57 robertj 00069 * Added GUI support. 00070 * 00071 * Revision 1.1 1995/03/14 12:44:11 robertj 00072 * Initial revision 00073 * 00074 */ 00075 00076 #ifndef _PMAIL 00077 #define _PMAIL 00078 00079 #ifdef P_USE_PRAGMA 00080 #pragma interface 00081 #endif 00082 00083 #ifdef _WIN32 00084 00085 # ifndef P_HAS_MAPI 00086 # define P_HAS_MAPI 1 00087 # endif 00088 00089 # ifndef P_HAS_CMC 00090 # define P_HAS_CMC 1 00091 # endif 00092 00093 # if P_HAS_MAPI 00094 # include <mapi.h> 00095 # endif 00096 00097 # if P_HAS_CMC 00098 # include <xcmc.h> 00099 # endif 00100 00101 #endif // _WIN32 00102 00103 00106 class PMail : public PObject 00107 { 00108 PCLASSINFO(PMail, PObject); 00109 00110 public: 00115 PMail(); 00116 00120 PMail( 00121 const PString & username, 00122 const PString & password 00123 ); 00124 00128 PMail( 00129 const PString & username, 00130 const PString & password, 00131 const PString & service 00136 ); 00137 00138 00139 virtual ~PMail(); 00140 /* Destroy the mail session, logging off the mail system if necessary. 00141 */ 00143 00151 BOOL LogOn( 00152 const PString & username, 00153 const PString & password 00154 ); 00155 00161 BOOL LogOn( 00162 const PString & username, 00163 const PString & password, 00164 const PString & service 00169 ); 00170 00176 virtual BOOL LogOff(); 00177 00183 BOOL IsLoggedOn() const; 00185 00194 BOOL SendNote( 00195 const PString & recipient, 00196 const PString & subject, 00197 const char * body 00198 ); 00199 00206 BOOL SendNote( 00207 const PString & recipient, 00208 const PString & subject, 00209 const char * body, 00210 const PStringList & attachments 00212 ); 00213 00220 BOOL SendNote( 00221 const PString & recipient, 00222 const PStringList & carbonCopies, 00223 const PStringList & blindCarbons, 00224 const PString & subject, 00225 const char * body, 00226 const PStringList & attachments 00228 ); 00230 00238 PStringArray GetMessageIDs( 00239 BOOL unreadOnly = TRUE 00240 ); 00241 00243 struct Header { 00245 PString subject; 00247 PString originatorName; 00249 PString originatorAddress; 00251 PTime received; 00252 }; 00253 00259 BOOL GetMessageHeader( 00260 const PString & id, 00261 Header & hdrInfo 00262 ); 00263 00280 BOOL GetMessageBody( 00281 const PString & id, 00282 PString & body, 00283 BOOL markAsRead = FALSE 00284 ); 00285 00291 BOOL GetMessageAttachments( 00292 const PString & id, 00293 PStringArray & filenames, 00294 BOOL includeBody = FALSE, 00295 BOOL markAsRead = FALSE 00296 ); 00297 00303 BOOL MarkMessageRead( 00304 const PString & id 00305 ); 00306 00312 BOOL DeleteMessage( 00313 const PString & id 00314 ); 00316 00319 00320 enum LookUpResult { 00322 UnknownUser, 00324 AmbiguousUser, 00326 ValidUser, 00328 LookUpError 00329 }; 00330 00337 LookUpResult LookUp( 00338 const PString & name, 00339 PString * fullName = NULL 00343 ); 00345 00354 int GetErrorCode() const; 00355 00362 PString GetErrorText() const; 00364 00365 00366 protected: 00367 void Construct(); 00368 // Common construction code. 00369 00371 BOOL loggedOn; 00372 00373 00374 // Include platform dependent part of class 00375 #ifdef _WIN32 00376 #include "msos/ptlib/mail.h" 00377 #else 00378 #include "unix/ptlib/mail.h" 00379 #endif 00380 }; 00381 00382 #endif 00383 00384 // End Of File ///////////////////////////////////////////////////////////////

Generated on Sat Jul 24 15:35:56 2004 for PWLib by doxygen 1.3.7