class PMail

This class establishes a mail session with the platforms mail system

Inheritance:


Public Methods

[more] Construction
[more] Log in/out functions
[more] Send message functions
[more] Read message functions
[more] Error functions

Public Members

[more] User look up functions

Protected Fields

[more]BOOL loggedOn
Flag indicating the session is active


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Public Members

Comparison functions


Documentation

This class establishes a mail session with the platforms mail system
o Construction

o PMail()
Create a mail session. It is initially not logged in.

o PMail( const PString & username, const PString & password )
Create a mail session. Attempt to log in using the parameters provided.
Parameters:
username - User withing mail system to use.
password - Password for user in mail system.

o PMail( const PString & username, const PString & password, const PString & service )
Create a mail session. Attempt to log in using the parameters provided.
Parameters:
username - User withing mail system to use.
password - Password for user in mail system.
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.

o Log in/out functions

oBOOL LogOn( const PString & username, const PString & password )
Attempt to log on to the mail system using the parameters provided.

Parameters:
username - User withing mail system to use.
password - Password for user in mail system.
Returns:
TRUE if successfully logged on.

oBOOL LogOn( const PString & username, const PString & password, const PString & service )
Attempt to log on to the mail system using the parameters provided.

Parameters:
username - User withing mail system to use.
password - Password for user in mail system.
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.
Returns:
TRUE if successfully logged on.

ovirtual BOOL LogOff()
Log off from the mail system.

Returns:
TRUE if successfully logged off.

oBOOL IsLoggedOn() const
Determine if the mail session is active and logged into the mail system.

Returns:
TRUE if logged into the mail system.

o Send message functions

oBOOL SendNote( const PString & recipient, const PString & subject, const char* body )
Send a new simple mail message.

Parameters:
recipient - Name of recipient of the mail message.
- subject Subject name for the mail message.
body - Text body of the mail message.
Returns:
TRUE if the mail message was successfully queued. Note that this does not mean that it has been delivered.

oBOOL SendNote( const PString & recipient, const PString & subject, const char* body, const PStringList & attachments )
Send a new simple mail message.

Parameters:
recipient - Name of recipient of the mail message.
- subject Subject name for the mail message.
body - Text body of the mail message.
attachments - List of files to attach to the mail message.
Returns:
TRUE if the mail message was successfully queued. Note that this does not mean that it has been delivered.

oBOOL SendNote( const PString & recipient, const PStringList & carbonCopies, const PStringList & blindCarbons, const PString & subject, const char* body, const PStringList & attachments )
Send a new simple mail message.

Parameters:
recipient - Name of recipient of the mail message.
carbonCopies - Name of CC recipients.
blindCarbons - Name of BCC recipients.
- subject Subject name for the mail message.
body - Text body of the mail message.
attachments - List of files to attach to the mail message.
Returns:
TRUE if the mail message was successfully queued. Note that this does not mean that it has been delivered.

o Read message functions

oPStringArray GetMessageIDs( BOOL unreadOnly = TRUE )
Get a list of ID strings for all messages in the mail box.

Parameters:
unreadOnly - Only get the IDs for unread messages.
Returns:
An array of ID strings.

ostruct Header
Message header for each mail item

oPString subject
Subject for message

oPString originatorName
Full name of message originator

oPString originatorAddress
Return address of message originator

oPTime received
Time message received

oBOOL GetMessageHeader( const PString & id, Header & hdrInfo )
Get the header information for a message.

Parameters:
id - Identifier of message to get header.
hdrInfo - Header info for the message.
Returns:
TRUE if header information was successfully obtained.

oBOOL GetMessageBody( const PString & id, PString & body, BOOL markAsRead = FALSE )
Get the body text for a message into the body 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 GetErrorCode() function must be used.

To get a large message body, the GetMessageAttachments() should be used with the includeBody parameter set to TRUE so that the message body is placed into a disk file.

Parameters:
id - Identifier of message to get body.
body - Body text of mail message.
markAsRead - Mark the message as read.
Returns:
TRUE if the body text was retrieved, FALSE if the body was too large or some other error occurred.

oBOOL GetMessageAttachments( const PString & id, PStringArray & filenames, BOOL includeBody = FALSE, BOOL markAsRead = FALSE )
Get all of the attachments for a message as disk files.

Parameters:
id - Identifier of message to get attachments.
filenames - File names for each attachment.
includeBody - Include the message body as first attachment
markAsRead - Mark the message as read
Returns:
TRUE if attachments were successfully obtained.

oBOOL MarkMessageRead( const PString & id )
Mark the message as read.

Parameters:
id - Identifier of message to get header.
Returns:
TRUE if message was successfully marked as read.

oBOOL DeleteMessage( const PString & id )
Delete the message from the system.

Parameters:
id - Identifier of message to get header.
Returns:
TRUE if message was successfully deleted.

o User look up functions

oenum LookUpResult
Result of a lookup operation with the LookUp() function

o UnknownUser
User name is unknown in mail system

o AmbiguousUser
User is ambiguous in mail system

o ValidUser
User is a valid, unique name in mail system

o LookUpError
An error occurred during the look up

oLookUpResult LookUp( const PString & name, PString* fullName = NULL )
Look up the specified name and verify that they are a valid address in the mail system.

Parameters:
name - Name to look up.
fullName - String to receive full name of user passed in name. If NULL then the full name is not returned.
Returns:
result of the name lookup.

o Error functions

oint GetErrorCode() const
Get the internal error code for the last error by a function in this mail session.

Returns:
integer error code for last operation.

oPString GetErrorText() const
Get the internal error description for the last error by a function in this mail session.

Returns:
string error text for last operation.

oBOOL loggedOn
Flag indicating the session is active


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.