Mail: ezcMailPop3Transport
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcMailPop3Transport
|
ezcMailPop3Transport implements POP3 for mail retrieval. [
source]
The implementation supports most of the basic commands specified in http://www.faqs.org/rfcs/rfc1939.html
The implementation also supports the following authentication methods: http://www.faqs.org/rfc/rfc1734.txt - auth
Constants
AUTH_APOP
= 2
|
APOP authorization |
AUTH_PLAIN_TEXT
= 1
|
Plain text authorization. |
STATE_AUTHORIZATION
= 2
|
Internal state set when the the pop3 transport is connected to the server but no successfull authentication has been performed. |
STATE_NOT_CONNECTED
= 1
|
Internal state set when the pop3 transport is not connected to a server. |
STATE_TRANSACTION
= 3
|
Internal state set when the pop3 transport is connected to the server and authenticated. |
STATE_UPDATE
= 4
|
Internal state set when the QUIT command has been issued to the pop3 server but before the disconnect has taken place. |
Method Summary
|
public ezcMailPop3Transport |
__construct(
$server, [$port = 110] )
Creates a new pop3 transport and connects to the $server. |
|
public void |
__destruct(
)
Destructs the pop3 transport. |
|
public void |
authenticate(
$user, $password, [$method = self::AUTH_PLAIN_TEXT] )
Authenticates the user to the POP3 server with the user $user and the password $password. |
|
public void |
delete(
$msgNum )
Deletes the message with the message number $msgNum from the server. |
|
public void |
disconnect(
)
Disconnects the transport from the pop3 server. |
|
public ezcMailParserSet |
fetchAll(
[$deleteFromServer = false] )
Returns a parserset with all the messages on the server. |
|
public array(int=>int) |
listMessages(
)
Returns a list of the messages on the server and the size of the messages in bytes. |
|
public array(int=>string) |
listUniqueIdentifiers(
[$msgNum = null] )
Returns the unique identifiers for each message on the POP3 server or for the specified message $msgNum if provided. |
|
public void |
status(
&$numMessages, &$sizeMessages )
Returns the number of messages on the server and the combined size of the messages through the input variables $numMessages and $sizeMessages. |
|
public string |
top(
$msgNum, $numLines )
Returns the headers and the $numLines first lines of the body of the mail with the message number $msgNum. |
Methods
__construct
ezcMailPop3Transport __construct(
string
$server, [int
$port = 110] )
Creates a new pop3 transport and connects to the $server.
You can specify the $port if the pop3 server is not on the default port 110.
Parameters
| Name |
Type |
Description |
$server |
string |
|
$port |
int |
|
Throws
| Class | Description |
ezcMailTransportException |
if it was not possible to connect to the server. |
__destruct
void __destruct(
)
Destructs the pop3 transport.
If there is an open connection to the pop3 server it is closed.
authenticate
void authenticate(
string
$user, string
$password, [mixed
$method = self::AUTH_PLAIN_TEXT] )
Authenticates the user to the POP3 server with the user $user and the password $password.
You can choose the authentication method with the $method parameter. The default is to use plaintext username and password.
This method should be called directly after the construction of this object.
Parameters
| Name |
Type |
Description |
$user |
string |
|
$password |
string |
|
Throws
| Class | Description |
ezcMailTransportException |
if the provided username/password combination did not work. |
delete
void delete(
$msgNum )
Deletes the message with the message number $msgNum from the server.
The message number must be a valid identifier fetched with e.g listMessages(). Any future reference to the message-number associated with the message in a command generates an error.
Parameters
| Name |
Type |
Description |
$msgNum |
|
|
Throws
| Class | Description |
ezcMailTransportException |
if the mail could not be deleted or if there is no connection to the server. |
disconnect
void disconnect(
)
Disconnects the transport from the pop3 server.
fetchAll
Returns a parserset with all the messages on the server.
If $deleteFromServer is set to true the mail will be removed from the server after retrieval. If not it will be left.
Parameters
| Name |
Type |
Description |
$deleteFromServer |
bool |
|
Throws
| Class | Description |
ezcMailTransportException |
if the mail could not be retrieved. |
listMessages
array(int=>int) listMessages(
)
Returns a list of the messages on the server and the size of the messages in bytes.
The format of the returned array is array(message_id => message_size)
Throws
| Class | Description |
ezcMailTransportException |
if there was no connection to the server or if the server sent a negative response. |
listUniqueIdentifiers
array(int=>string) listUniqueIdentifiers(
[int
$msgNum = null] )
Returns the unique identifiers for each message on the POP3 server or for the specified message $msgNum if provided.
You can fetch the unique identifier for a specific message only by providing the $msgNum parameter.
The unique identifier can be used to recognize mail from servers between requests. In contrast to the message numbers the unique numbers assigned to an email never changes.
The format of the returned array is array(message_num => unique_identifier)
Note: POP3 servers are not required to support this command and it may fail.
Parameters
| Name |
Type |
Description |
$msgNum |
int |
The message number |
Throws
| Class | Description |
ezcMailTransportException |
if there was no connection to the server. |
status
void status(
int
&$numMessages, int
&$sizeMessages )
Returns the number of messages on the server and the combined size of the messages through the input variables $numMessages and $sizeMessages.
Parameters
| Name |
Type |
Description |
&$numMessages |
int |
|
&$sizeMessages |
int |
|
top
string top(
int
$msgNum, int
$numLines )
Returns the headers and the $numLines first lines of the body of the mail with the message number $msgNum.
If the command failed or if it was not supported by the server an empty string is returned.
Note: POP3 servers are not required to support this command and it may fail.
Parameters
| Name |
Type |
Description |
$msgNum |
int |
|
$numLines |
int |
|
Throws
| Class | Description |
ezcMailTransportException |
if there was no connection to the server or if the server sent a negative response. |
Last updated: Wed, 28 Nov 2007