# PPOP3Client Class Reference

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

`#include <inetmail.h>`

Inheritance diagram for PPOP3Client:

List of all members.

## Public Types

| AllowUserPass = 1
| Allow the use of the plain old USER/PASS if APOP or SASL are not available.
| UseSASL = 2
| Use SASL if the AUTH command is supported by the server.
| AllowClearTextSASL = 4
| Allow LOGIN and PLAIN mechanisms to be used.
enum | LoginOptions { AllowUserPass = 1, UseSASL = 2, AllowClearTextSASL = 4 }

## Public Member Functions

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

## Protected Member Functions

PBoolean | OnOpen ()
| This callback is executed when the Open() function is called with open channels.

## Protected Attributes

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

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