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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Mail
- Subpackage
- Protocol
- Version
- $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
\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.
- Children
- \Zend_Mail_Protocol_Smtp
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Todo
- Implement proxy settings
- Version
- $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
Constants
Properties

array $_log = array()Log of mail requests and server responses for a session
array()Details- Type
- array

resource $_template = '%d%s'String template for parsing server responses using sscanf (default: 3 digit code and response string)
'%d%s'Details- Type
- resource
- Deprecated
- Since 1.10.3

\Zend_Validate $_validHost = Instance of Zend_Validate to check hostnames
- Type
- \Zend_Validate
Methods

__construct(string $host = '127.0.0.1', integer $port = null) : voidConstructor.
| Name | Type | Description |
|---|---|---|
| $host | string | OPTIONAL Hostname of remote connection (default: 127.0.0.1) |
| $port | integer | OPTIONAL Port number (default: null) |
| Exception | Description |
|---|---|
| \Zend_Mail_Protocol_Exception |

_addLog(string $value) : voidAdd the transaction log
| Name | Type | Description |
|---|---|---|
| $value | string | new transaction |

_connect(string $remote) : booleanConnect 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'
| Name | Type | Description |
|---|---|---|
| $remote | string | Remote |
| Type | Description |
|---|---|
| boolean |
| Exception | Description |
|---|---|
| \Zend_Mail_Protocol_Exception |

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

_receive( $timeout = null) : stringGet a line from the stream.
| Name | Type | Description |
|---|---|---|
| $timeout |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Mail_Protocol_Exception |
- integer
Per-request timeout value if applicable

_send(string $request) : integer | booleanSend the given request followed by a LINEEND to the server.
| Name | Type | Description |
|---|---|---|
| $request | string |
| Type | Description |
|---|---|
| integer | boolean | Number of bytes written to remote host |
| Exception | Description |
|---|---|
| \Zend_Mail_Protocol_Exception |

_setStreamTimeout(integer $timeout) : booleanSet stream timeout
| Name | Type | Description |
|---|---|---|
| $timeout | integer |
| Type | Description |
|---|---|
| boolean |

connect() : voidCreate 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.