00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _PMAIL
00035 #define _PMAIL
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #ifdef _WIN32
00042
00043 # ifndef P_HAS_MAPI
00044 # define P_HAS_MAPI 1
00045 # endif
00046
00047 # ifndef P_HAS_CMC
00048 # define P_HAS_CMC 1
00049 # endif
00050
00051 # if P_HAS_MAPI
00052 # include <mapi.h>
00053 # endif
00054
00055 # if P_HAS_CMC
00056 # include <xcmc.h>
00057 # endif
00058
00059 #endif // _WIN32
00060
00061
00064 class PMail : public PObject
00065 {
00066 PCLASSINFO(PMail, PObject);
00067
00068 public:
00073 PMail();
00074
00078 PMail(
00079 const PString & username,
00080 const PString & password
00081 );
00082
00086 PMail(
00087 const PString & username,
00088 const PString & password,
00089 const PString & service
00094 );
00095
00096
00097 virtual ~PMail();
00098
00099
00101
00109 PBoolean LogOn(
00110 const PString & username,
00111 const PString & password
00112 );
00113
00119 PBoolean LogOn(
00120 const PString & username,
00121 const PString & password,
00122 const PString & service
00127 );
00128
00134 virtual PBoolean LogOff();
00135
00141 PBoolean IsLoggedOn() const;
00143
00152 PBoolean SendNote(
00153 const PString & recipient,
00154 const PString & subject,
00155 const char * body
00156 );
00157
00164 PBoolean SendNote(
00165 const PString & recipient,
00166 const PString & subject,
00167 const char * body,
00168 const PStringList & attachments
00170 );
00171
00178 PBoolean SendNote(
00179 const PString & recipient,
00180 const PStringList & carbonCopies,
00181 const PStringList & blindCarbons,
00182 const PString & subject,
00183 const char * body,
00184 const PStringList & attachments
00186 );
00188
00196 PStringArray GetMessageIDs(
00197 PBoolean unreadOnly = PTrue
00198 );
00199
00201 struct Header {
00203 PString subject;
00205 PString originatorName;
00207 PString originatorAddress;
00209 PTime received;
00210 };
00211
00217 PBoolean GetMessageHeader(
00218 const PString & id,
00219 Header & hdrInfo
00220 );
00221
00238 PBoolean GetMessageBody(
00239 const PString & id,
00240 PString & body,
00241 PBoolean markAsRead = PFalse
00242 );
00243
00249 PBoolean GetMessageAttachments(
00250 const PString & id,
00251 PStringArray & filenames,
00252 PBoolean includeBody = PFalse,
00253 PBoolean markAsRead = PFalse
00254 );
00255
00261 PBoolean MarkMessageRead(
00262 const PString & id
00263 );
00264
00270 PBoolean DeleteMessage(
00271 const PString & id
00272 );
00274
00277
00278 enum LookUpResult {
00280 UnknownUser,
00282 AmbiguousUser,
00284 ValidUser,
00286 LookUpError
00287 };
00288
00295 LookUpResult LookUp(
00296 const PString & name,
00297 PString * fullName = NULL
00301 );
00303
00312 int GetErrorCode() const;
00313
00320 PString GetErrorText() const;
00322
00323
00324 protected:
00325 void Construct();
00326
00327
00329 PBoolean loggedOn;
00330
00331
00332
00333 #ifdef _WIN32
00334 #include "msos/ptlib/mail.h"
00335 #else
00336 #include "unix/ptlib/mail.h"
00337 #endif
00338 };
00339
00340 #endif
00341
00342