PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PPOP3Client Class Reference

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

`#include <inetmail.h>`

Inheritance diagram for PPOP3Client:
[legend]
Collaboration diagram for PPOP3Client:
[legend]

## Public Types
enum | LoginOptions { AllowUserPass = 1, UseSASL = 2, AllowClearTextSASL = 4 }
Public Types inherited from PPOP3
enum | Commands { USER, PASS, QUIT, RSET, NOOP, STATcmd, LIST, RETR, DELE, APOP, TOP, UIDL, AUTH, NumCommands }

## Public Member Functions
| PPOP3Client ()
| Create a TCP/IP POP3 protocol socket channel. More...
| ~PPOP3Client ()
| Destroy the channel object. More...
virtual PBoolean | Close ()
| Close the socket, and if connected as a client, QUITs from server. More...
PBoolean | LogIn (const PString &username, const PString &password, int options=AllowUserPass)
| Log into the POP server using the mailbox and access codes specified. More...
int | GetMessageCount ()
| Get a count of the number of messages in the mail box. More...
PUnsignedArray | GetMessageSizes ()
| Get an array of a integers representing the sizes of each of the messages in the mail box. More...
PStringArray | GetMessageHeaders ()
| Get an array of a strings representing the standard internet message headers of each of the messages in the mail box. More...
PBoolean | BeginMessage (PINDEX messageNumber)
PBoolean | DeleteMessage (PINDEX messageNumber)
| Delete the message specified from the mail box. More...

## Protected Member Functions
PBoolean | OnOpen ()
| This callback is executed when the Open() function is called with open channels. More...
Protected Member Functions inherited from PPOP3
| PPOP3 ()
virtual PINDEX | ParseResponse (const PString &line)
| Parse a response line string into a response code and any extra info on the line. More...
Protected Member Functions inherited from PInternetProtocol
| PInternetProtocol (const char *defaultServiceName, PINDEX cmdCount, char const *const *cmdNames)

## Protected Attributes
PBoolean | loggedIn
PString | apopBanner

## Additional Inherited Members
Static Public Member Functions inherited from PChannel
static PString | GetErrorText (Errors lastError, int osError=0)
| Get error message description. More...
static PBoolean | ConvertOSError (P_INT_PTR libcReturnValue, Errors &lastError, int &osError)
| Convert an operating system error into platform independent error. More...
Static Public Member Functions inherited from PObject
static const char * | Class ()
| Get the name of the class as a C string. More...
static __inline const PObject * | PTraceObjectInstance (const char *)
static __inline const PObject * | PTraceObjectInstance (const PObject *obj)
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
| Internal function caled from CompareObjectMemoryDirect() More...
Protected Types inherited from PInternetProtocol
enum | StuffState { DontStuff, StuffIdle, StuffCR, StuffCRLF, StuffCRLFdot, StuffCRLFdotCR }
Static Protected Member Functions inherited from PPOP3
static const PString & | okResponse ()
static const PString & | errResponse ()
Friends inherited from PObject

## 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

Enumerator
AllowUserPass | Allow the use of the plain old USER/PASS if APOP or SASL are not available.
UseSASL | Use SASL if the AUTH command is supported by the server.
AllowClearTextSASL | Allow LOGIN and PLAIN mechanisms to be used.

## 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

PBoolean 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 PBoolean 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.

PBoolean 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.

PBoolean 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.

Parameters

  username | User name on remote system.
  password | Password for user name.
  options | See LoginOptions above

PBoolean 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

PBoolean PPOP3Client::loggedIn
| protected

The documentation for this class was generated from the following file:

- inetmail.h