Zend_Mail_Protocol_Abstract

Provides low-level methods for concrete adapters to communicate with a remote mail server and track requests and responses.

category Zend
package Zend_Mail
subpackage Protocol
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
version $Id$
todo Implement proxy settings

 Methods

Constructor.

__construct(string $host = '127.0.0.1', integer $port = null) : void

Parameters

$host

string

OPTIONAL Hostname of remote connection (default: 127.0.0.1)

$port

integer

OPTIONAL Port number (default: null)

Exceptions

\Zend_Mail_Protocol_Exception

Class destructor to cleanup open resources

__destruct() : void

Create a connection to the remote host

connect() 

Concrete adapters for this class will implement their own unique connect scripts, using the _connect() method to create the socket resource.

Retrieve the transaction log

getLog() : string

Returns

string

Get the maximum log size

getMaximumLog() : integer

Returns

integerthe maximum log size

Retrieve the last client request

getRequest() : string

Returns

string

Retrieve the last server response

getResponse() : array

Returns

array

Reset the transaction log

resetLog() : void

Set the maximum log size

setMaximumLog(integer $maximumLog) : void

Parameters

$maximumLog

integer

Maximum log size

Add the transaction log

_addLog($value) : void

Parameters

$value

Connect to the server using the supplied transport and target

_connect(string $remote) : boolean

An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222'

Parameters

$remote

string

Remote

Exceptions

\Zend_Mail_Protocol_Exception

Returns

boolean

Disconnect from remote host and free resource

_disconnect() : void

Parse server response for successful codes

_expect(string|array $code, $timeout = null) : string

Read the response from the stream and check for expected return code. Throws a Zend_Mail_Protocol_Exception if an unexpected code is returned.

Parameters

$code

stringarray

One or more codes that indicate a successful response

$timeout

Exceptions

\Zend_Mail_Protocol_Exception

Returns

stringLast line of response string

Get a line from the stream.

_receive($timeout = null) : string
var

Per-request timeout value if applicable

Parameters

$timeout

Exceptions

\Zend_Mail_Protocol_Exception

Returns

string

Send the given request followed by a LINEEND to the server.

_send(string $request) : integer | boolean

Parameters

$request

string

Exceptions

\Zend_Mail_Protocol_Exception

Returns

integerbooleanNumber of bytes written to remote host

Set stream timeout

_setStreamTimeout(integer $timeout) : boolean

Parameters

$timeout

integer

Returns

boolean

 Properties

 

Hostname or IP address of remote server

$_host : string

Default

 

Maximum of the transaction log

$_maximumLog : integer

Default

64
 

Port number of connection

$_port : integer

Default

 

Last request sent to server

$_request : string

Default

 

Array of server responses to last request

$_response : array

Default

 

Socket connection resource

$_socket : resource

Default

 

String template for parsing server responses using sscanf (default: 3 digit code and response string)

$_template : resource

Default

'%d%s'
deprecated Since 1.10.3
 

Instance of Zend_Validate to check hostnames

$_validHost : \Zend_Validate

Default

 

Log of mail requests and server responses for a session

$_log : array

Default

array()

 Constants

 

Mail default EOL string

EOL = "\r\n" 
 

Default timeout in seconds for initiating session

TIMEOUT_CONNECTION = 30