Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

PPOP3Client Class Reference

#include <inetmail.h>

Inheritance diagram for PPOP3Client:

PPOP3 PInternetProtocol PIndirectChannel PChannel PObject List of all members.

Public Types

enum  LoginOptions { AllowUserPass = 1, UseSASL = 2, AllowClearTextSASL = 4 }

Public Methods

 PPOP3Client ()
 ~PPOP3Client ()
virtual BOOL Close ()
BOOL LogIn (const PString &username, const PString &password, int options=AllowUserPass)
int GetMessageCount ()
PUnsignedArray GetMessageSizes ()
PStringArray GetMessageHeaders ()
BOOL BeginMessage (PINDEX messageNumber)
BOOL DeleteMessage (PINDEX messageNumber)

Protected Methods

BOOL OnOpen ()

Protected Attributes

BOOL loggedIn
PString apopBanner

Detailed Description

A TCP/IP socket for the Post Office Protocol version 3.

When acting as a client, the procedure is to make the connection to a remote server, then to retrieve a message using the following procedure:


      PPOP3Client mail;
      if (mail.Connect("popserver")) {
        if (mail.LogIn("Me", "password")) {
          if (mail.GetMessageCount() > 0) {
            PUnsignedArray sizes = mail.GetMessageSizes();
            for (PINDEX i = 0; i < sizes.GetSize(); i++) {
              if (mail.BeginMessage(i+1))
                mail.Read(myMessage, sizes[i]);
              else
                PError << "Error getting mail message." << endl;
            }
          }
          else
            PError << "No mail messages." << endl;
        }
        else
           PError << "Mail log in failed." << endl;
      }
      else
         PError << "Mail conection failed." << endl;
      


Member Enumeration Documentation

enum PPOP3Client::LoginOptions
 

Enumeration values:
AllowUserPass 
UseSASL 
AllowClearTextSASL 


Constructor & Destructor Documentation

PPOP3Client::PPOP3Client  
 

Create a TCP/IP POP3 protocol socket channel. The parameterless form creates an unopened socket, the form with the address parameter makes a connection to a remote system, opening the socket. The form with the socket parameter opens the socket to an incoming call from a "listening" socket.

PPOP3Client::~PPOP3Client  
 

Destroy the channel object. This will close the channel and as a client, QUIT from remote POP3 server.


Member Function Documentation

BOOL PPOP3Client::BeginMessage PINDEX    messageNumber
 

Parameters:
messageNumber  Number of message to retrieve. This is an integer from 1 to the maximum number of messages available.

virtual BOOL PPOP3Client::Close   [virtual]
 

Close the socket, and if connected as a client, QUITs from server.

Returns:
TRUE if the channel was closed and the QUIT accepted by the server.

Reimplemented from PIndirectChannel.

BOOL PPOP3Client::DeleteMessage PINDEX    messageNumber
 

Delete the message specified from the mail box.

Returns:
Array of strings continaing message headers.

int PPOP3Client::GetMessageCount  
 

Get a count of the number of messages in the mail box.

Returns:
Number of messages in mailbox or -1 if an error occurred.

PStringArray PPOP3Client::GetMessageHeaders  
 

Get an array of a strings representing the standard internet message headers of each of the messages in the mail box.

Note that the remote server may not support this function, in which case an empty array will be returned.

Returns:
Array of strings continaing message headers.

PUnsignedArray PPOP3Client::GetMessageSizes  
 

Get an array of a integers representing the sizes of each of the messages in the mail box.

Returns:
Array of integers representing the size of each message.

BOOL PPOP3Client::LogIn const PString   username,
const PString   password,
int    options = AllowUserPass
 

Log into the POP server using the mailbox and access codes specified.

Returns:
TRUE if logged in.

BOOL PPOP3Client::OnOpen   [protected, virtual]
 

This callback is executed when the Open() function is called with open channels. It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.

The default behaviour is to simply return TRUE.

Returns:
Returns TRUE if the protocol handshaking is successful.

Reimplemented from PIndirectChannel.


Member Data Documentation

PString PPOP3Client::apopBanner [protected]
 

BOOL PPOP3Client::loggedIn [protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Aug 13 15:50:09 2004 for PWLib by doxygen1.2.18