/usr/include/ptlib/mail.h is in libpt-dev 2.10.11~dfsg-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | /*
* mail.h
*
* Electronic Mail abstraction class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 24461 $
* $Author: shorne $
* $Date: 2010-06-06 09:06:37 -0500 (Sun, 06 Jun 2010) $
*/
#ifndef PTLIB_MAIL_H
#define PTLIB_MAIL_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#if defined(_WIN32) && !defined(_WIN64)
# ifndef P_HAS_MAPI
# define P_HAS_MAPI 1
# endif
# ifndef P_HAS_CMC
# define P_HAS_CMC 1
# endif
# if P_HAS_MAPI
# include <mapi.h>
# endif
# if P_HAS_CMC
# include <xcmc.h>
# endif
#endif // _WIN32
/**This class establishes a mail session with the platforms mail system.
*/
class PMail : public PObject
{
PCLASSINFO(PMail, PObject);
public:
/**@name Construction */
//@{
/**Create a mail session. It is initially not logged in.
*/
PMail();
/**Create a mail session.
Attempt to log in using the parameters provided.
*/
PMail(
const PString & username, ///< User withing mail system to use.
const PString & password ///< Password for user in mail system.
);
/**Create a mail session.
Attempt to log in using the parameters provided.
*/
PMail(
const PString & username, ///< User withing mail system to use.
const PString & password, ///< Password for user in mail system.
const PString & service
/**A platform dependent string indicating the location of the underlying
messaging service, eg the path to a message store or node name of the
mail server.
*/
);
virtual ~PMail();
/* Destroy the mail session, logging off the mail system if necessary.
*/
//@}
/**@name Log in/out functions */
//@{
/**Attempt to log on to the mail system using the parameters provided.
@return
true if successfully logged on.
*/
PBoolean LogOn(
const PString & username, ///< User withing mail system to use.
const PString & password ///< Password for user in mail system.
);
/**Attempt to log on to the mail system using the parameters provided.
@return
true if successfully logged on.
*/
PBoolean LogOn(
const PString & username, ///< User withing mail system to use.
const PString & password, ///< Password for user in mail system.
const PString & service
/**A platform dependent string indicating the location of the underlying
messaging service, eg the path to a message store or node name of the
mail server.
*/
);
/**Log off from the mail system.
@return
true if successfully logged off.
*/
virtual PBoolean LogOff();
/**Determine if the mail session is active and logged into the mail system.
@return
true if logged into the mail system.
*/
PBoolean IsLoggedOn() const;
//@}
/**@name Send message functions */
//@{
/**Send a new simple mail message.
@return
true if the mail message was successfully queued. Note that this does
{\b not} mean that it has been delivered.
*/
PBoolean SendNote(
const PString & recipient, ///< Name of recipient of the mail message.
const PString & subject, ///< Subject name for the mail message.
const char * body ///< Text body of the mail message.
);
/**Send a new simple mail message.
@return
true if the mail message was successfully queued. Note that this does
{\b not} mean that it has been delivered.
*/
PBoolean SendNote(
const PString & recipient, ///< Name of recipient of the mail message.
const PString & subject, ///< Subject name for the mail message.
const char * body, ///< Text body of the mail message.
const PStringList & attachments
///< List of files to attach to the mail message.
);
/**Send a new simple mail message.
@return
true if the mail message was successfully queued. Note that this does
{\b not} mean that it has been delivered.
*/
PBoolean SendNote(
const PString & recipient, ///< Name of recipient of the mail message.
const PStringList & carbonCopies, ///< Name of CC recipients.
const PStringList & blindCarbons, ///< Name of BCC recipients.
const PString & subject, ///< Subject name for the mail message.
const char * body, ///< Text body of the mail message.
const PStringList & attachments
///< List of files to attach to the mail message.
);
//@}
/**@name Read message functions */
//@{
/**Get a list of ID strings for all messages in the mail box.
@return
An array of ID strings.
*/
PStringArray GetMessageIDs(
PBoolean unreadOnly = true ///< Only get the IDs for unread messages.
);
/// Message header for each mail item.
struct Header {
/// Subject for message.
PString subject;
/// Full name of message originator.
PString originatorName;
/// Return address of message originator.
PString originatorAddress;
/// Time message received.
PTime received;
};
/**Get the header information for a message.
@return
true if header information was successfully obtained.
*/
PBoolean GetMessageHeader(
const PString & id, ///< Identifier of message to get header.
Header & hdrInfo ///< Header info for the message.
);
/**Get the body text for a message into the <code>body</code> string
parameter.
Note that if the body text for the mail message is very large, the
function will return false. To tell between an error getting the message
body and having a large message body the <code>GetErrorCode()</code> function
must be used.
To get a large message body, the <code>GetMessageAttachments()</code> should
be used with the <code>includeBody</code> parameter set to true so that
the message body is placed into a disk file.
@return
true if the body text was retrieved, false if the body was too large or
some other error occurred.
*/
PBoolean GetMessageBody(
const PString & id, ///< Identifier of message to get body.
PString & body, ///< Body text of mail message.
PBoolean markAsRead = false ///< Mark the message as read.
);
/**Get all of the attachments for a message as disk files.
@return
true if attachments were successfully obtained.
*/
PBoolean GetMessageAttachments(
const PString & id, ///< Identifier of message to get attachments.
PStringArray & filenames, ///< File names for each attachment.
PBoolean includeBody = false, ///< Include the message body as first attachment
PBoolean markAsRead = false ///< Mark the message as read
);
/**Mark the message as read.
@return
true if message was successfully marked as read.
*/
PBoolean MarkMessageRead(
const PString & id ///< Identifier of message to get header.
);
/**Delete the message from the system.
@return
true if message was successfully deleted.
*/
PBoolean DeleteMessage(
const PString & id ///< Identifier of message to get header.
);
//@}
/**@name User look up functions */
//@{
/// Result of a lookup operation with the <code>LookUp()</code> function.
enum LookUpResult {
/// User name is unknown in mail system.
UnknownUser,
/// User is ambiguous in mail system.
AmbiguousUser,
/// User is a valid, unique name in mail system.
ValidUser,
/// An error occurred during the look up
LookUpError
};
/**Look up the specified name and verify that they are a valid address in
the mail system.
@return
result of the name lookup.
*/
LookUpResult LookUp(
const PString & name, ///< Name to look up.
PString * fullName = NULL
/**<String to receive full name of user passed in <code>name</code>. If
NULL then the full name is <b>not</b> returned.
*/
);
//@}
/**@name Error functions */
//@{
/**Get the internal error code for the last error by a function in this
mail session.
@return
integer error code for last operation.
*/
int GetErrorCode() const;
/**Get the internal error description for the last error by a function in
this mail session.
@return
string error text for last operation.
*/
PString GetErrorText() const;
//@}
protected:
void Construct();
// Common construction code.
/// Flag indicating the session is active.
PBoolean loggedOn;
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/mail.h"
#else
#include "unix/ptlib/mail.h"
#endif
};
#endif // PTLIB_MAIL_H
// End Of File ///////////////////////////////////////////////////////////////
|