API Documentation

Mail/Protocol/Abstract.php

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Mail  
subpackage
Protocol  
version
$Id: Abstract.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_Mail_Protocol_Abstract

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  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Mail  
subpackage
Protocol  
todo
Implement proxy settings  
version
$Id: Abstract.php 23775 2011-03-01 17:25:24Z ralph $  

Constants

Constant  EOL = '\r\n'

Mail default EOL string

Constant  TIMEOUT_CONNECTION = '30'

Default timeout in seconds for initiating session

Properties

Propertyprotectedstring  $_host= ''

Hostname or IP address of remote server

Details
Type
string
Propertyprivatearray  $_log= 'array'

Log of mail requests and server responses for a session

Default valuearrayDetails
Type
array
Propertyprotectedinteger  $_maximumLog= '64'

Maximum of the transaction log

Default value64Details
Type
integer
Propertyprotectedinteger  $_port= ''

Port number of connection

Details
Type
integer
Propertyprotectedstring  $_request= ''

Last request sent to server

Details
Type
string
Propertyprotectedarray  $_response= ''

Array of server responses to last request

Details
Type
array
Propertyprotectedresource  $_socket= ''

Socket connection resource

Details
Type
resource
Propertyprotectedresource  $_template= '%d%s'

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

Default value%d%sDetails
Type
resource
deprecated
Since 1.10.3  
Propertyprotected\Zend_Validate  $_validHost= ''

Instance of Zend_Validate to check hostnames

Details
Type
\Zend_Validate

Methods

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

Constructor.

Parameters
Name Type Description
$host string

OPTIONAL Hostname of remote connection (default: 127.0.0.1)

$port integer

OPTIONAL Port number (default: null)

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublic__destruct( ) : void

Class destructor to cleanup open resources

methodprotected_addLog( string $value ) : void

Add the transaction log

Parameters
Name Type Description
$value string new transaction
methodprotected_connect( string $remote ) : boolean

Connect to the server using the supplied transport and target

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

Parameters
Name Type Description
$remote string Remote
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_disconnect( ) : void

Disconnect from remote host and free resource

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

Parse server response for successful codes

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
Name Type Description
$code string|array One or more codes that indicate a successful response
$timeout
Returns
Type Description
string Last line of response string
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_receive(  $timeout = null ) : string

Get a line from the stream.

Parameters
Name Type Description
$timeout
Returns
Type Description
string
Throws
Exception Description
\Zend_Mail_Protocol_Exception
Details
integer
Per-request timeout value if applicable
methodprotected_send( string $request ) : integer|boolean

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

Parameters
Name Type Description
$request string
Returns
Type Description
integerboolean Number of bytes written to remote host
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_setStreamTimeout( integer $timeout ) : boolean

Set stream timeout

Parameters
Name Type Description
$timeout integer
Returns
Type Description
boolean
methodpublicconnect( ) : void
abstract

Create a connection to the remote host

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

methodpublicgetLog( ) : string

Retrieve the transaction log

Returns
Type Description
string
methodpublicgetMaximumLog( ) : int

Get the maximum log size

Returns
Type Description
int the maximum log size
methodpublicgetRequest( ) : string

Retrieve the last client request

Returns
Type Description
string
methodpublicgetResponse( ) : array

Retrieve the last server response

Returns
Type Description
array
methodpublicresetLog( ) : void

Reset the transaction log

methodpublicsetMaximumLog( integer $maximumLog ) : void

Set the maximum log size

Parameters
Name Type Description
$maximumLog integer Maximum log size
Documentation was generated by DocBlox 0.13.3.